public override object __hx_invoke1_o(double __fn_float1, object __fn_dyn1) { unchecked { #line 326 "/opt/haxe/std/haxe/io/Path.hx" global::EReg regex = (((__fn_dyn1 == global::haxe.lang.Runtime.undefined)) ? (((global::EReg)(((object)(__fn_float1))))) : (((global::EReg)(__fn_dyn1)))); #line 326 "/opt/haxe/std/haxe/io/Path.hx" return(global::haxe.lang.StringExt.fromCharCode((global::Std.parseInt(regex.matched(1))).@value)); } #line default }
public override object __hx_invoke1_o(double __fn_float1, object __fn_dyn1) { #line 331 "/opt/haxe/std/haxe/io/Path.hx" global::EReg v = (((__fn_dyn1 == global::haxe.lang.Runtime.undefined)) ? (((global::EReg)(((object)(__fn_float1))))) : (((global::EReg)(__fn_dyn1)))); #line 331 "/opt/haxe/std/haxe/io/Path.hx" return(global::haxe.lang.Runtime.concat("-x", global::haxe.lang.Runtime.toString((global::haxe.lang.StringExt.charCodeAt(v.matched(0), 0)).toDynamic()))); }
public static long evaluate(string expression) { unchecked { expression = global::StringTools.replace(expression, " ", ""); global::System.Console.WriteLine(((object)(expression))); int parens = 0; string subExpression = ""; global::EReg ereg = new global::EReg("[(]", ""); while (ereg.match(expression)) { int _g = 0; int _g1 = expression.Length; while ((_g < _g1)) { int i = _g++; if ((global::haxe.lang.StringExt.charAt(expression, i) == "(")) { ++parens; } if ((parens > 0)) { subExpression = global::haxe.lang.Runtime.concat(subExpression, global::haxe.lang.StringExt.charAt(expression, i)); } if ((global::haxe.lang.StringExt.charAt(expression, i) == ")")) { --parens; if ((parens == 0)) { global::System.Console.WriteLine(((object)(subExpression))); expression = global::StringTools.replace(expression, subExpression, global::haxe.lang.Runtime.concat("", (global::haxe.lang.Runtime.concat("", global::Std.@string(((long)(global::solutions.Day18.evaluate(global::haxe.lang.StringExt.substr(subExpression, 1, new global::haxe.lang.Null <int>((subExpression.Length - 2), true)))))))))); global::System.Console.WriteLine(((object)(expression))); subExpression = ""; break; } } } } ereg = new global::EReg("[+]", ""); string currExpression = expression; long result = ((long)(0)); while (ereg.match(currExpression)) { long left = default(long); global::EReg leftReg = new global::EReg("[+*]", ""); if (leftReg.match(ereg.matchedLeft())) { string matchForward = ereg.matchedLeft(); while (leftReg.match(matchForward)) { matchForward = leftReg.matchedRight(); } left = global::haxe._Int64.Int64_Impl_.parseString(leftReg.matchedRight()); global::System.Console.WriteLine(((object)(global::haxe.lang.Runtime.concat("left: ", (global::haxe.lang.Runtime.concat("", global::Std.@string(((long)(left))))))))); } else { left = global::haxe._Int64.Int64_Impl_.parseString(ereg.matchedLeft()); global::System.Console.WriteLine(((object)(global::haxe.lang.Runtime.concat("left: ", (global::haxe.lang.Runtime.concat("", global::Std.@string(((long)(left))))))))); } string op = ereg.matched(0); long right = default(long); global::EReg rightReg = new global::EReg("[+*]", ""); if (rightReg.match(ereg.matchedRight())) { right = global::haxe._Int64.Int64_Impl_.parseString(rightReg.matchedLeft()); } else { right = global::haxe._Int64.Int64_Impl_.parseString(ereg.matchedRight()); } global::System.Console.WriteLine(((object)(left))); global::System.Console.WriteLine(((object)(op))); global::System.Console.WriteLine(((object)(right))); result = ((long)((((long)(left)) + ((long)(right))))); global::System.Console.WriteLine(((object)(global::haxe.lang.Runtime.concat("=", (global::haxe.lang.Runtime.concat("", global::Std.@string(((long)(result))))))))); global::System.Console.WriteLine(((object)(""))); currExpression = global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat(global::haxe.lang.StringExt.substr(currExpression, 0, new global::haxe.lang.Null <int>(global::haxe.lang.StringExt.indexOf(currExpression, global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat("", global::Std.@string(((long)(left)))), op), (global::haxe.lang.Runtime.concat("", global::Std.@string(((long)(right)))))), default(global::haxe.lang.Null <int>)), true)), (global::haxe.lang.Runtime.concat("", global::Std.@string(((long)(result)))))), global::haxe.lang.StringExt.substr(currExpression, (global::haxe.lang.StringExt.indexOf(currExpression, global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat("", global::Std.@string(((long)(left)))), op), (global::haxe.lang.Runtime.concat("", global::Std.@string(((long)(right)))))), default(global::haxe.lang.Null <int>)) + (global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat("", global::Std.@string(((long)(left)))), op), (global::haxe.lang.Runtime.concat("", global::Std.@string(((long)(right))))))).Length), default(global::haxe.lang.Null <int>))); } global::System.Console.WriteLine(((object)(global::haxe.lang.Runtime.concat("curr: ", currExpression)))); ereg = new global::EReg("[*]", ""); while (ereg.match(currExpression)) { long left1 = default(long); global::EReg leftReg1 = new global::EReg("[*]", ""); if (leftReg1.match(ereg.matchedLeft())) { string matchForward1 = ereg.matchedLeft(); while (leftReg1.match(matchForward1)) { matchForward1 = leftReg1.matchedRight(); } left1 = global::haxe._Int64.Int64_Impl_.parseString(leftReg1.matchedRight()); global::System.Console.WriteLine(((object)(global::haxe.lang.Runtime.concat("left: ", (global::haxe.lang.Runtime.concat("", global::Std.@string(((long)(left1))))))))); } else { left1 = global::haxe._Int64.Int64_Impl_.parseString(ereg.matchedLeft()); global::System.Console.WriteLine(((object)(global::haxe.lang.Runtime.concat("left: ", (global::haxe.lang.Runtime.concat("", global::Std.@string(((long)(left1))))))))); } string op1 = ereg.matched(0); long right1 = default(long); global::EReg rightReg1 = new global::EReg("[+*]", ""); if (rightReg1.match(ereg.matchedRight())) { right1 = global::haxe._Int64.Int64_Impl_.parseString(rightReg1.matchedLeft()); } else { right1 = global::haxe._Int64.Int64_Impl_.parseString(ereg.matchedRight()); } global::System.Console.WriteLine(((object)(left1))); global::System.Console.WriteLine(((object)(op1))); global::System.Console.WriteLine(((object)(right1))); result = ((long)((((long)(left1)) * ((long)(right1))))); global::System.Console.WriteLine(((object)(global::haxe.lang.Runtime.concat("=", (global::haxe.lang.Runtime.concat("", global::Std.@string(((long)(result))))))))); global::System.Console.WriteLine(((object)(""))); currExpression = global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat("", global::Std.@string(((long)(result)))), global::haxe.lang.StringExt.substr(currExpression, (global::haxe.lang.StringExt.indexOf(currExpression, global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat("", global::Std.@string(((long)(left1)))), op1), (global::haxe.lang.Runtime.concat("", global::Std.@string(((long)(right1)))))), default(global::haxe.lang.Null <int>)) + (global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat("", global::Std.@string(((long)(left1)))), op1), (global::haxe.lang.Runtime.concat("", global::Std.@string(((long)(right1))))))).Length), default(global::haxe.lang.Null <int>))); } return(result); } }