| 89 | |
| 90 | const parseUserSnippets = function (source, lang, session) { |
| 91 | const replaceParams = function (str) { |
| 92 | let i = 1 |
| 93 | // eslint-disable-next-line no-useless-escape, no-template-curly-in-string |
| 94 | str = str.replace(/(?:[^(,)]+ )?([a-zA-Z-0-9\$\-\u00A2-\uFFFF]+)([^,)]*)/g, '${:$1}') // /(?:[^(,)]+ )?/ part for ignoring the type declaration in cpp/java |
| 95 | const reg = /\$\{:/ |
| 96 | while (reg.test(str)) { |
| 97 | str = str.replace(reg, `\${${i}:`) |
| 98 | i += 1 |
| 99 | } |
| 100 | return str |
| 101 | } |
| 102 | |
| 103 | const makeEntry = function (name, content, importance) { |
| 104 | content = content != null ? content : name |