Skip to content

Instantly share code, notes, and snippets.

@SelStrom
Last active November 26, 2016 15:17
Show Gist options
  • Save SelStrom/5abc86abeba14e1021a7015f97af5a8a to your computer and use it in GitHub Desktop.
Save SelStrom/5abc86abeba14e1021a7015f97af5a8a to your computer and use it in GitHub Desktop.
Replasing standart types;
//(uint)|(\Wint)|(Number)|(boolean)|(protected)
//$1$2$3$4$5
uint
UInt
int
Int
Number
Float
boolean
Bool
protected
private
Converting body:
(?-s)(package.+?) ?(\r\n)\{.*\r\n([\s\S]+)\}
$1;$2$3
Removing first tab if needs (works with buggy):
(?-s)(\t)(.+\r\n)
$2
Replasing constructors:
(?:public|internal) ((?:final )?class (\w+)[\s\S]+)\b\2\b
$1new
Replasing getters and setters:
(get|set) (.+)
$1_$2
Replasing simple for
for ?\(var ?(\w+) ?: ?Int ?= ?(\d+); ?\1 ?< ?([\w\.]+); ?\1\+\+ ?\)
for($1 in $2...$3)
Replasing tricky for
for ?\(var ?(\w+) ?: ?Int ?= ?(\d+) ?, ?size ?\: ?Int ?= ?([\w\.\[\]\(\)\"\']+); ?\1 ?< ?size ?; ?\1\+\+ ?\)
for($1 in $2...$3)
cleaning Alcon debug:
Debug.trace\((?:_TITLE_CLASS)? ?\+ ?(["'].+["']),? ?(?:Debug.+)?\);
trace($1);
Debug.traceObj\( ?([\w\.\(\)\[\]\"\']+) ?(?:, ?64, ?Debug.+)\);
trace($1);
Debug.traceObj.+
<empty line>
Replase simple type cast expression
(\b\w[\w\.]*(?:\(\w[\w\.\'\"]*\)))? as (\w+) //worst then next
cast($1, $2)
(?<!\w)\((\w[\w\.\[\]\(\)\'\"]*) as (\w+)\)
cast($1, $2)
((?:var .+: ?(?:\w+) ?= ?)|(?:return ))(\w[\w\.\[\]\(\)\'\"]*) as (\w+);
$1cast $2;
(\b\w+)\[([\w\(\)\[\}\"\'\.]+)\] ?= ?(.+);
Generatin fiedls. The setters must beeng include manualy
((\t*)(?:public|private) function (get_(\w+))\(\) ?: ?(.*))
$2public var $4($3, null) : $5;\r\n$1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment