Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* eslint-disable */
const fs = require('fs');
const P = require('parsimmon');
const config = require('../config');
const lTagArrow = P.string('<');
const rTagArrow = P.string('>');
const endLine = P.string('/');
const doubleQuote = P.string('"');
const singleQuote = P.string("'");
const whitespaces = P.regex(/\s*/).desc('whitespaces');
const Wxml = P.createLanguage({
Symbol: function () {
return P.regexp(/[a-zA-Z_-][a-zA-Z0-9_-]*/).desc("symbol");
},
StringExpression: function () {
// return P.regexp(/[^<]+/);
return P.regex(/((?!<\/).)+/);
},
singleQuoteString: function () {
return P.seqMap(
singleQuote,
P.regexp(/[^']*/),
singleQuote,
function (r1, r2, r3) {
return {
type: 'single',
)
),
Parsimmon.string('\udb40\udc7f') // cancel tag
);
var ZeroWidthJoiner = Parsimmon.string('\u200d')
.desc('zero-width joiner (\\u200d)');
var OptionalFitzpatrickModifier =
Parsimmon.regex(/(\ud83c[\udffb-\udfff]){0,1}/)
.desc('an optional Fitzpatrick modifier');
var SimpleEmoji = Parsimmon.alt(
// Simple Unicode emoji
Parsimmon.regex(/[\u203c-\u2bff]/),
Parsimmon.regex(/[\u2702-\u27b0]/),
// Enclosed CJK Letters and Months
Parsimmon.regex(/[\u3200-\u32ff]/),
// Emoji flags
FlagEmoji,
GreatBritainEmoji,
// Surrogate pairs
Parsimmon.regex(/\ud83c[\udc04-\udfff]/),
Parsimmon.regex(/\ud83d[\udc00-\udfff]/),
Parsimmon.regex(/\ud83e[\udc00-\udfff]/)
);
var VariationSelectorEmoji = Parsimmon.seq(
// Single characters that become emoji only with a variation selector
Parsimmon.alt(
Parsimmon.string('\u00a9'), // trademark
Parsimmon.string('\u00ae'), // copyright
)
.desc("integer");
var FractionalDigits =
P.seq(
P.string("."),
P.regex(/[0-9]/),
P.regex(/[0-9_]*[0-9]/).or(P.of(""))
)
.desc("fractional digits")
.map(join(""));
var Exponential =
P.seq(
P.regex(/[eE]/),
P.regex(/[+-]?/),
Integer
)
.desc("exponential")
.map(join(""));
var Float =
P.seq(
Integer,
FractionalDigits.or(P.of("")),
Exponential.or(P.of(""))
)
.map(join(""));
var NaN_ = P.string("NaN").desc("NaN");
var Infinity_ = P.string("Infinity").desc("Infinity");
function indexedNothing(ctor, parser) {
return indexedSequence(ctor, parser.result([]));
}
var inone = indexedNothing;
function combineIndices(index1, index2) {
return {
start: (index1 || index2).start,
end: (index2 || index1).end
};
}
var indc = combineIndices;
var NameParser = P.regex(/[_a-z][_a-z0-9]*/i).desc("name");
function keyword(kw) {
return NameParser.chain(function(x) {
if (x === kw) {
return P.of(kw);
} else {
return P.fail(kw);
}
});
}
module.exports = {
cons: cons,
wrap: wrap,
pwrap: pwrap,
spaced: spaced,
}
export interface Declarelation {
label: string;
text: string;
}
export interface Node extends Declarelation {
start: Position;
end: Position;
}
let lsec = regex(/.*\[/);
let rsec = regex(/\].*/);
let sectionText = regex(/[^#\]]+/).map(text => {return {label: 'section', text: text}; }).mark();
let rank = regex(/#*/);
let section = seqMap(lsec, sectionText, rsec, (...params) => params[1]);
let equal = regex(/=+/);
let lapi = string('{');
let rapi = string('}');
let api = regex(/[^}]+/).map(text => {return {label: 'api', text: text}; }).mark();
let directionText = regex(/.*/).map(text => {return {label: 'direction', text: text}; }).mark();
let lt = string('>').skip(optWhitespace);
let directionWithoutApi = seqMap(equal, lt, directionText, (...params) => params[2]);
let directionWithApi = seqMap(equal, lapi, api, rapi, equal, lt, directionText, (...params) => [params[2], params[6]]);
let direction = alt(directionWithoutApi, directionWithApi);
let text = regex(/.*/).mark().map(text => {
return {label: 'text', text: text};
});
var P = require("parsimmon");
var ast = require("../ast");
var H = require("../parse-helpers");
var join = H.join;
var ione = H.ione;
function stripUnderscores(s) {
return s.replace(/_/g, "");
}
var Integer =
P.alt(
P.regex(/[1-9][0-9_]*[0-9]/),
P.regex(/[0-9]/)
)
.desc("integer");
var FractionalDigits =
P.seq(
P.string("."),
P.regex(/[0-9]/),
P.regex(/[0-9_]*[0-9]/).or(P.of(""))
)
.desc("fractional digits")
.map(join(""));
var Exponential =
P.seq(
P.regex(/[eE]/),
P.regex(/[+-]?/),
label: string;
text: string;
}
export interface Node extends Declarelation {
start: Position;
end: Position;
}
let lsec = regex(/.*\[/);
let rsec = regex(/\].*/);
let sectionText = regex(/[^#\]]+/).map(text => {return {label: 'section', text: text}; }).mark();
let rank = regex(/#*/);
let section = seqMap(lsec, sectionText, rsec, (...params) => params[1]);
let equal = regex(/=+/);
let lapi = string('{');
let rapi = string('}');
let api = regex(/[^}]+/).map(text => {return {label: 'api', text: text}; }).mark();
let directionText = regex(/.*/).map(text => {return {label: 'direction', text: text}; }).mark();
let lt = string('>').skip(optWhitespace);
let directionWithoutApi = seqMap(equal, lt, directionText, (...params) => params[2]);
let directionWithApi = seqMap(equal, lapi, api, rapi, equal, lt, directionText, (...params) => [params[2], params[6]]);
let direction = alt(directionWithoutApi, directionWithApi);
let text = regex(/.*/).mark().map(text => {
return {label: 'text', text: text};
});
let line = optWhitespace.then(alt(section, direction, text));
let eol = regex(/\r?\n/);
'use strict';
var Parsimmon = require('parsimmon');
var flattenDeep = require('lodash.flattendeep');
var OptionalVariationSelector =
exports.OptionalVariationSelector = Parsimmon.regex(/[\ufe0e\ufe0f]{0,1}/)
.desc('an optional variation selector (\\ufe0e or \\ufe0f)');
var RequiredVariationSelector =
exports.RequiredVariationSelector = Parsimmon.regex(/[\ufe0e\ufe0f]/)
.desc('an required variation selector (\\ufe0e or \\ufe0f)');
var KeycapEmoji = Parsimmon.seq(
Parsimmon.regex(/[0-9#*]/),
OptionalVariationSelector,
Parsimmon.string('\u20e3')
).desc('a keycap emoji');
var FlagEmoji = Parsimmon.regex(/\ud83c[\udde6-\uddff]/)
.times(2)
.desc('a flag emoji');
function stripUnderscores(s) {
return s.replace(/_/g, "");
}
var Integer =
P.alt(
P.regex(/[1-9][0-9_]*[0-9]/),
P.regex(/[0-9]/)
)
.desc("integer");
var FractionalDigits =
P.seq(
P.string("."),
P.regex(/[0-9]/),
P.regex(/[0-9_]*[0-9]/).or(P.of(""))
)
.desc("fractional digits")
.map(join(""));
var Exponential =
P.seq(
P.regex(/[eE]/),
P.regex(/[+-]?/),
Integer
)
.desc("exponential")
.map(join(""));
var Float =
P.seq(
link() {
return P.seqMap(
P.regex(/[^\]\r\n]+/).wrap(P.string("["), P.string("]")),
P.regex(/[^)\r\n]+/).wrap(P.string("("), P.string(")")),
(text, link) => ({
type: "a",
props: {
href: link,
children: [text]
}
})
);
},
image() {