mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
Sankey stream is ending on node only
This commit is contained in:
parent
f71769e07b
commit
5eae790740
@ -35,9 +35,7 @@
|
||||
if(this.topState()==='value') this.popState();
|
||||
return 'CLOSE_STRING';
|
||||
}
|
||||
<string>([^"\\]|\\\")+ { console.log(this.state); return 'STRING'; }
|
||||
|
||||
// TODO: check if jison will return 2 separate tokens (for nodes) while ignoring whitespace
|
||||
<string>([^"\\]|\\\")+ { return 'STRING'; }
|
||||
|
||||
/lex
|
||||
|
||||
@ -55,20 +53,28 @@ document
|
||||
|
|
||||
;
|
||||
|
||||
// : NODE exhaust intake exhaust_chain optional_attributes EOS
|
||||
line
|
||||
: flow EOS
|
||||
| node_with_attributes EOS
|
||||
: stream optional_attributes EOS
|
||||
| NODE optional_attributes EOS
|
||||
| EOS
|
||||
;
|
||||
|
||||
node_with_attributes: NODE OPEN_ATTRIBUTES attributes CLOSE_ATTRIBUTES;
|
||||
optional_attributes: OPEN_ATTRIBUTES attributes CLOSE_ATTRIBUTES | ;
|
||||
|
||||
attributes: attribute attributes | ;
|
||||
attribute: ATTRIBUTE EQUAL value | ATTRIBUTE;
|
||||
|
||||
value: VALUE | OPEN_STRING STRING CLOSE_STRING;
|
||||
|
||||
flow: n_chain_a;
|
||||
stream: NODE ARROW AMOUNT ARROW tail;
|
||||
tail: stream | NODE;
|
||||
|
||||
n_chain_a: NODE ARROW a_chain_n | NODE;
|
||||
a_chain_n: AMOUNT ARROW n_chain_a | AMOUNT;
|
||||
// exhaust_chain: ARROW AMOUNT intake_chain | ;
|
||||
// intake_chain: ARROW NODE exhaust_chain | ;
|
||||
|
||||
// exhaust: ARROW AMOUNT;
|
||||
// intake: ARROW NODE;
|
||||
|
||||
// node_chain_amount: NODE ARROW amount_node_chain | NODE;
|
||||
// amount_node_chain: AMOUNT ARROW node_chain_amount | AMOUNT;
|
||||
|
@ -30,9 +30,9 @@ describe('Sankey diagram', function () {
|
||||
it('recognizes multiple flows', () => {
|
||||
const str = `
|
||||
sankey
|
||||
a -> 30 -> b -> 12 -> e;
|
||||
c -> 30 -> d -> 12 -> e;
|
||||
c -> 40 -> e -> 12 -> q;
|
||||
a -> 30 -> b -> 12 -> e
|
||||
c -> 30 -> d -> 12 -> e
|
||||
c -> 40 -> e -> 12 -> q
|
||||
`;
|
||||
|
||||
parser.parse(str);
|
||||
@ -58,81 +58,11 @@ describe('Sankey diagram', function () {
|
||||
const str = `
|
||||
sankey
|
||||
node[attr="hello, how are you?"]
|
||||
node[attr="hello\\""]
|
||||
node[attr="hello\\"afaasd"]
|
||||
`;
|
||||
|
||||
parser.parse(str);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
// it('recognizes grouped values', () => {
|
||||
// const str = `
|
||||
// sankey
|
||||
// a -> {30} -> b
|
||||
// `;
|
||||
|
||||
// parser.parse(str);
|
||||
// });
|
||||
|
||||
|
||||
|
||||
// it('recognizes intake group', () => {
|
||||
// const str = `
|
||||
// sankey
|
||||
// a -> {
|
||||
// 30 -> b
|
||||
// 40 -> c
|
||||
// }
|
||||
// `;
|
||||
|
||||
// parser.parse(str);
|
||||
// });
|
||||
|
||||
// it('recognizes exhaust group', () => {
|
||||
// const str = `
|
||||
// sankey
|
||||
// {
|
||||
// b -> 30
|
||||
// c -> 40
|
||||
// } -> a
|
||||
// `;
|
||||
|
||||
// parser.parse(str);
|
||||
// });
|
||||
|
||||
// it('what to do?', () => {
|
||||
// const str = `
|
||||
// sankey
|
||||
// {
|
||||
// b -> 30
|
||||
// c -> 40
|
||||
// } -> {
|
||||
// e
|
||||
// d
|
||||
// }
|
||||
// `;
|
||||
|
||||
// parser.parse(str);
|
||||
// });
|
||||
|
||||
// it('complex', () => {
|
||||
// const str = `
|
||||
// sankey
|
||||
// {
|
||||
// a -> 30
|
||||
// b -> 40
|
||||
// } -> c -> {
|
||||
// 20 -> e -> 49
|
||||
// 20 -> d -> 23
|
||||
// } -> k -> 20 -> i -> {
|
||||
// 10 -> f
|
||||
// 11 -> j
|
||||
// }
|
||||
// `;
|
||||
|
||||
// parser.parse(str);
|
||||
// });
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user