Update Objc Rules
This commit is contained in:
parent
d22ab48d7c
commit
8b1404bd4e
4 changed files with 55 additions and 54 deletions
21
tool/wrap_keyword_regexp.js
Normal file
21
tool/wrap_keyword_regexp.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
// a little script to turn giant keyword regexps into
|
||||
// something that ace can use; for example:
|
||||
//
|
||||
// \b(NS(Rect(ToCGRect|FromCGRect)|MakeCollectable|S(tringFromProtocol))\b
|
||||
//
|
||||
// into
|
||||
//
|
||||
// (?:\\b)(NS(?:Rect(?:ToCGRect|FromCGRect)|MakeCollectable|S(?:tringFromProtocol))(?:\b)
|
||||
|
||||
var inputString = process.argv.splice(2)[0];
|
||||
|
||||
// solve word boundaries
|
||||
var outputString = inputString.replace(/\\b/g, "(?:\\\\b)");
|
||||
|
||||
// I apparently need to do this, instead of something clever, because the regexp
|
||||
// lastIndex is screwing up my positional
|
||||
outputString = outputString.split("b)(");
|
||||
|
||||
outputString = outputString[0] + "b)(" + outputString[1].replace(/\(([^\?])/g, "(?:$1");
|
||||
|
||||
console.log("\n\n" + outputString + "\n\n");
|
||||
Loading…
Add table
Add a link
Reference in a new issue