Merge + Binaries

This commit is contained in:
Knut Sveidqvist
2021-12-11 08:31:43 +01:00
26 changed files with 17660 additions and 17494 deletions

View File

@@ -149,7 +149,7 @@ export const addMembers = function (className, members) {
export const cleanupLabel = function (label) {
if (label.substring(0, 1) === ':') {
return label.substr(1).trim();
return common.sanitizeText(label.substr(1).trim(), configApi.getConfig());
} else {
return label.trim();
}

View File

@@ -560,7 +560,7 @@ direction
alphaNumToken : PUNCTUATION | AMP | UNICODE_TEXT | NUM| ALPHA | COLON | COMMA | PLUS | EQUALS | MULT | DOT | BRKT| UNDERSCORE ;
idStringToken : ALPHA|UNDERSCORE |UNICODE_TEXT | NUM| COLON | COMMA | PLUS | MINUS | DOWN |EQUALS | MULT | BRKT | DOT | PUNCTUATION | AMP;
idStringToken : ALPHA|UNDERSCORE |UNICODE_TEXT | NUM| COLON | COMMA | PLUS | MINUS | DOWN |EQUALS | MULT | BRKT | DOT | PUNCTUATION | AMP | DEFAULT;
graphCodeTokens: STADIUMSTART | STADIUMEND | SUBROUTINESTART | SUBROUTINEEND | VERTEX_WITH_PROPS_START | CYLINDERSTART | CYLINDEREND | TRAPSTART | TRAPEND | INVTRAPSTART | INVTRAPEND | PIPE | PS | PE | SQS | SQE | DIAMOND_START | DIAMOND_STOP | TAGSTART | TAGEND | ARROW_CROSS | ARROW_POINT | ARROW_CIRCLE | ARROW_OPEN | QUOTE | SEMI;
%%

View File

@@ -51,6 +51,18 @@ describe('when parsing ', function () {
expect(edges[0].end).toBe('monograph');
});
it('should allow default in the node name/id', function () {
const res = flow.parser.parse('graph TD\ndefault --> monograph');
const vert = flow.parser.yy.getVertices();
const edges = flow.parser.yy.getEdges();
expect(vert['default'].id).toBe('default');
expect(vert['monograph'].id).toBe('monograph');
expect(edges[0].start).toBe('default');
expect(edges[0].end).toBe('monograph');
});
describe('special characters should be be handled.', function () {
const charTest = function (char, result) {
const res = flow.parser.parse('graph TD;A(' + char + ')-->B;');

12
src/jison/loader.js Normal file
View File

@@ -0,0 +1,12 @@
const { Generator } = require('jison');
const validate = require('schema-utils');
const schema = require('./parser-options-schema.json');
module.exports = function jisonLoader(source) {
const options = this.getOptions();
(validate.validate || validate)(schema, options, {
name: 'Jison Loader',
baseDataPath: 'options',
});
return new Generator(source, options).generate();
};

View File

@@ -0,0 +1,13 @@
{
"title": "Jison Parser options",
"type": "object",
"properties": {
"token-stack": {
"type": "boolean"
},
"debug": {
"type": "boolean"
}
},
"additionalProperties": false
}

7
src/jison/transformer.js Normal file
View File

@@ -0,0 +1,7 @@
const { Generator } = require('jison');
module.exports = {
process(sourceText, sourcePath, options) {
return new Generator(sourceText, options.transformerConfig).generate();
},
};