MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / parseArgs

Function parseArgs

lib/web/CodeMirror/keymap/vim.js:4907–4928  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4905 sort: function(cm, params) {
4906 var reverse, ignoreCase, unique, number, pattern;
4907 function parseArgs() {
4908 if (params.argString) {
4909 var args = new CodeMirror.StringStream(params.argString);
4910 if (args.eat('!')) { reverse = true; }
4911 if (args.eol()) { return; }
4912 if (!args.eatSpace()) { return 'Invalid arguments'; }
4913 var opts = args.match(/([dinuox]+)?\s*(\/.+\/)?\s*/);
4914 if (!opts && !args.eol()) { return 'Invalid arguments'; }
4915 if (opts[1]) {
4916 ignoreCase = opts[1].indexOf('i') != -1;
4917 unique = opts[1].indexOf('u') != -1;
4918 var decimal = opts[1].indexOf('d') != -1 || opts[1].indexOf('n') != -1 && 1;
4919 var hex = opts[1].indexOf('x') != -1 && 1;
4920 var octal = opts[1].indexOf('o') != -1 && 1;
4921 if (decimal + hex + octal > 1) { return 'Invalid arguments'; }
4922 number = decimal && 'decimal' || hex && 'hex' || octal && 'octal';
4923 }
4924 if (opts[2]) {
4925 pattern = new RegExp(opts[2].substr(1, opts[2].length - 2), ignoreCase ? 'i' : '');
4926 }
4927 }
4928 }
4929 var err = parseArgs();
4930 if (err) {
4931 showConfirm(cm, err + ': ' + params.argString);

Callers 1

VimFunction · 0.85

Calls 5

eatMethod · 0.95
eolMethod · 0.95
eatSpaceMethod · 0.95
matchMethod · 0.95
indexOfMethod · 0.80

Tested by

no test coverage detected