|
@ -7247,6 +7247,9 @@ Timeline.prototype.getItemRange = function getItemRange() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// parse node
|
|
|
// parse node
|
|
|
|
|
|
if (tokenType != TOKENTYPE.IDENTIFIER) { |
|
|
|
|
|
throw newSyntaxError('Identifier expected'); |
|
|
|
|
|
} |
|
|
var id = token; // id can be a string or a number
|
|
|
var id = token; // id can be a string or a number
|
|
|
getToken(); |
|
|
getToken(); |
|
|
|
|
|
|
|
@ -7256,6 +7259,9 @@ Timeline.prototype.getItemRange = function getItemRange() { |
|
|
if (!graph.attr) { |
|
|
if (!graph.attr) { |
|
|
graph.attr = {}; |
|
|
graph.attr = {}; |
|
|
} |
|
|
} |
|
|
|
|
|
if (tokenType != TOKENTYPE.IDENTIFIER) { |
|
|
|
|
|
throw newSyntaxError('Identifier expected'); |
|
|
|
|
|
} |
|
|
graph.attr[id] = token; |
|
|
graph.attr[id] = token; |
|
|
getToken(); |
|
|
getToken(); |
|
|
// TODO: implement comma separated list with "ID=ID"
|
|
|
// TODO: implement comma separated list with "ID=ID"
|
|
@ -7276,7 +7282,7 @@ Timeline.prototype.getItemRange = function getItemRange() { |
|
|
// optional subgraph keyword
|
|
|
// optional subgraph keyword
|
|
|
if (token == 'subgraph') { |
|
|
if (token == 'subgraph') { |
|
|
subgraph = {}; |
|
|
subgraph = {}; |
|
|
subgraph.type = token; |
|
|
|
|
|
|
|
|
subgraph.type = 'subgraph'; |
|
|
getToken(); |
|
|
getToken(); |
|
|
|
|
|
|
|
|
// optional graph id
|
|
|
// optional graph id
|
|
@ -7296,7 +7302,7 @@ Timeline.prototype.getItemRange = function getItemRange() { |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// TODO: copy global node and edge attributes into subgraph?
|
|
|
|
|
|
|
|
|
// TODO: copy global node and edge attributes into subgraph or not?
|
|
|
|
|
|
|
|
|
// statements
|
|
|
// statements
|
|
|
parseStatements(subgraph); |
|
|
parseStatements(subgraph); |
|
@ -7399,14 +7405,19 @@ Timeline.prototype.getItemRange = function getItemRange() { |
|
|
to = subgraph; |
|
|
to = subgraph; |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
|
|
|
if (tokenType != TOKENTYPE.IDENTIFIER) { |
|
|
|
|
|
throw newSyntaxError('Identifier or subgraph expected'); |
|
|
|
|
|
} |
|
|
to = token; |
|
|
to = token; |
|
|
addNode(graph, { |
|
|
addNode(graph, { |
|
|
id: to |
|
|
id: to |
|
|
}); |
|
|
}); |
|
|
getToken(); |
|
|
getToken(); |
|
|
var attr = parseAttributeList(); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// parse edge attributes
|
|
|
|
|
|
var attr = parseAttributeList(); |
|
|
|
|
|
|
|
|
// create edge
|
|
|
// create edge
|
|
|
var edge = createEdge(graph, from, to, type, attr); |
|
|
var edge = createEdge(graph, from, to, type, attr); |
|
|
addEdge(graph, edge); |
|
|
addEdge(graph, edge); |
|
|