|
@ -10,6 +10,29 @@ |
|
|
* @return {Object} graph An object containing two parameters: |
|
|
* @return {Object} graph An object containing two parameters: |
|
|
* {Object[]} nodes |
|
|
* {Object[]} nodes |
|
|
* {Object[]} edges |
|
|
* {Object[]} edges |
|
|
|
|
|
* |
|
|
|
|
|
* ------------------------------------------- |
|
|
|
|
|
* TODO |
|
|
|
|
|
* ==== |
|
|
|
|
|
* |
|
|
|
|
|
* For label handling, this is an incomplete implementation. From docs (quote #3015): |
|
|
|
|
|
* |
|
|
|
|
|
* > the escape sequences "\n", "\l" and "\r" divide the label into lines, centered, |
|
|
|
|
|
* > left-justified, and right-justified, respectively. |
|
|
|
|
|
* |
|
|
|
|
|
* Source: http://www.graphviz.org/content/attrs#kescString
|
|
|
|
|
|
* |
|
|
|
|
|
* > As another aid for readability, dot allows double-quoted strings to span multiple physical |
|
|
|
|
|
* > lines using the standard C convention of a backslash immediately preceding a newline |
|
|
|
|
|
* > character |
|
|
|
|
|
* > In addition, double-quoted strings can be concatenated using a '+' operator. |
|
|
|
|
|
* > As HTML strings can contain newline characters, which are used solely for formatting, |
|
|
|
|
|
* > the language does not allow escaped newlines or concatenation operators to be used |
|
|
|
|
|
* > within them. |
|
|
|
|
|
* |
|
|
|
|
|
* - Currently, only '\\n' is handled |
|
|
|
|
|
* - Note that text explicitly says 'labels'; the dot parser currently handles escape |
|
|
|
|
|
* sequences in **all** strings. |
|
|
*/ |
|
|
*/ |
|
|
function parseDOT (data) { |
|
|
function parseDOT (data) { |
|
|
dot = data; |
|
|
dot = data; |
|
@ -358,9 +381,14 @@ function getToken() { |
|
|
if (c === '"') { |
|
|
if (c === '"') { |
|
|
next(); |
|
|
next(); |
|
|
while (c != '' && (c != '"' || (c === '"' && nextPreview() === '"'))) { |
|
|
while (c != '' && (c != '"' || (c === '"' && nextPreview() === '"'))) { |
|
|
token += c; |
|
|
|
|
|
if (c === '"') { // skip the escape character
|
|
|
|
|
|
|
|
|
if (c === '"') { // skip the escape character
|
|
|
|
|
|
token += c; |
|
|
|
|
|
next(); |
|
|
|
|
|
} else if (c === '\\' && nextPreview() === 'n') { // Honor a newline escape sequence
|
|
|
|
|
|
token += '\n'; |
|
|
next(); |
|
|
next(); |
|
|
|
|
|
} else { |
|
|
|
|
|
token += c; |
|
|
} |
|
|
} |
|
|
next(); |
|
|
next(); |
|
|
} |
|
|
} |
|
|