Пример #1
0
        public static int countBags(string bagName, int multiplier)
        {
            unchecked {
                int                    count       = 0;
                global::EReg           bagRegex    = new global::EReg("(bag)s?,?", "");
                global::Array <string> childBagArr = new global::Array <string>(new string[] {});
                string                 input       = global::haxe.lang.Runtime.toString((((global::haxe.ds.StringMap <string>)(global::haxe.ds.StringMap <object> .__hx_cast <string>(((global::haxe.ds.StringMap)(((global::haxe.IMap <string, string>)(global::solutions.Day7.bagMap))))))).@get(bagName)).toDynamic());
                while (bagRegex.match(input))
                {
                    string curr = bagRegex.matchedLeft().Trim();
                    if ((global::haxe.lang.StringExt.indexOf(curr, "other", default(global::haxe.lang.Null <int>)) > -1))
                    {
                        break;
                    }

                    childBagArr.push(curr);
                    input = bagRegex.matchedRight();
                }

                {
                    int _g = 0;
                    while ((_g < childBagArr.length))
                    {
                        string bag = childBagArr[_g];
                        ++_g;
                        global::haxe.lang.Null <int> @value = global::Std.parseInt(global::haxe.lang.StringExt.charAt(bag, 0));
                        count += (multiplier * (@value).@value);
                        count += global::solutions.Day7.countBags(global::haxe.lang.StringExt.substr(bag, 2, default(global::haxe.lang.Null <int>)), (multiplier * (@value).@value));
                    }
                }

                return(count);
            }
        }
Пример #2
0
 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())));
 }
Пример #3
0
 public static string escape(string path, global::haxe.lang.Null <bool> allowSlashes)
 {
                 #line 329 "/opt/haxe/std/haxe/io/Path.hx"
     bool         allowSlashes1 = ((!(allowSlashes.hasValue)) ? (false) : ((allowSlashes).@value));
     global::EReg regex         = ((allowSlashes1) ? (new global::EReg("[^A-Za-z0-9_/\\\\\\.]", "g")) : (new global::EReg("[^A-Za-z0-9_\\.]", "g")));
                 #line 331 "/opt/haxe/std/haxe/io/Path.hx"
     return(regex.map(path, (((global::haxe.io.Path_escape_331__Fun.__hx_current != null)) ? (global::haxe.io.Path_escape_331__Fun.__hx_current) : (global::haxe.io.Path_escape_331__Fun.__hx_current = ((global::haxe.io.Path_escape_331__Fun)(new global::haxe.io.Path_escape_331__Fun()))))));
 }
Пример #4
0
 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
 }
Пример #5
0
    private static void __hx_ctor__EReg(global::EReg __hx_this, string r, string opt)
    {
        unchecked {
            int opts = ((int)(global::haxe.lang.Runtime.toInt(((object)(global::System.Text.RegularExpressions.RegexOptions.CultureInvariant)))));
            {
                int _g  = 0;
                int _g1 = opt.Length;
                while ((_g < _g1))
                {
                    int i = _g++;
                    switch (((int)(opt[i])))
                    {
                    case 99:
                    {
                        opts |= ((int)(global::haxe.lang.Runtime.toInt(((object)(global::System.Text.RegularExpressions.RegexOptions.Compiled)))));
                        break;
                    }


                    case 103:
                    {
                        __hx_this.isGlobal = true;
                        break;
                    }


                    case 105:
                    {
                        opts |= ((int)(global::haxe.lang.Runtime.toInt(((object)(global::System.Text.RegularExpressions.RegexOptions.IgnoreCase)))));
                        break;
                    }


                    case 109:
                    {
                        opts |= ((int)(global::haxe.lang.Runtime.toInt(((object)(global::System.Text.RegularExpressions.RegexOptions.Multiline)))));
                        break;
                    }
                    }
                }
            }

            __hx_this.regex = new global::System.Text.RegularExpressions.Regex(((string)(r)), ((global::System.Text.RegularExpressions.RegexOptions)(((object)(opts)))));
        }
    }
Пример #6
0
        public static global::haxe.ds.StringMap <string> processPassport(string passport)
        {
            unchecked {
                global::Array <string>             fields    = new global::EReg("[ ]|\r\n", "g").split(passport);
                global::haxe.ds.StringMap <string> keyValues = new global::haxe.ds.StringMap <string>();
                {
                    int _g = 0;
                    while ((_g < fields.length))
                    {
                        string field = fields[_g];
                        ++_g;
                        {
                            string k = global::haxe.lang.StringExt.substr(field, 0, new global::haxe.lang.Null <int>(3, true));
                            string v = global::haxe.lang.StringExt.substr(field, 4, new global::haxe.lang.Null <int>((field.Length - 4), true));
                            keyValues.@set(k, v);
                        }
                    }
                }

                return(keyValues);
            }
        }
Пример #7
0
        public virtual void writeNode(global::Xml @value, string tabs)
        {
            unchecked {
                                #line 50 "/opt/haxe/std/haxe/xml/Printer.hx"
                switch (@value.nodeType)
                {
                case 0:
                {
                                                #line 68 "/opt/haxe/std/haxe/xml/Printer.hx"
                    this.output.b.Append(((string)(global::Std.@string(global::haxe.lang.Runtime.concat(tabs, "<")))));
                    {
                                                        #line 69 "/opt/haxe/std/haxe/xml/Printer.hx"
                        if ((@value.nodeType != global::Xml.Element))
                        {
                                                                #line 69 "/opt/haxe/std/haxe/xml/Printer.hx"
                            throw ((global::System.Exception)(global::haxe.Exception.thrown(global::haxe.lang.Runtime.concat("Bad node type, expected Element but found ", global::_Xml.XmlType_Impl_.toString(@value.nodeType)))));
                        }

                                                        #line 69 "/opt/haxe/std/haxe/xml/Printer.hx"
                        this.output.b.Append(((string)(global::Std.@string(@value.nodeName))));
                    }

                                                #line 70 "/opt/haxe/std/haxe/xml/Printer.hx"
                    {
                                                        #line 70 "/opt/haxe/std/haxe/xml/Printer.hx"
                        object attribute = @value.attributes();
                                                        #line 70 "/opt/haxe/std/haxe/xml/Printer.hx"
                        while (global::haxe.lang.Runtime.toBool(global::haxe.lang.Runtime.callField(attribute, "hasNext", 407283053, null)))
                        {
                                                                #line 70 "/opt/haxe/std/haxe/xml/Printer.hx"
                            string attribute1 = global::haxe.lang.Runtime.toString(global::haxe.lang.Runtime.callField(attribute, "next", 1224901875, null));
                            this.output.b.Append(((string)(global::Std.@string(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat(" ", attribute1), "=\"")))));
                                                                #line 72 "/opt/haxe/std/haxe/xml/Printer.hx"
                            {
                                                                        #line 72 "/opt/haxe/std/haxe/xml/Printer.hx"
                                string input = global::StringTools.htmlEscape(@value.@get(attribute1), new global::haxe.lang.Null <bool>(true, true));
                                                                        #line 72 "/opt/haxe/std/haxe/xml/Printer.hx"
                                this.output.b.Append(((string)(global::Std.@string(input))));
                            }

                                                                #line 73 "/opt/haxe/std/haxe/xml/Printer.hx"
                            this.output.b.Append(((string)("\"")));
                        }
                    }

                                                #line 75 "/opt/haxe/std/haxe/xml/Printer.hx"
                    if (this.hasChildren(@value))
                    {
                                                        #line 76 "/opt/haxe/std/haxe/xml/Printer.hx"
                        this.output.b.Append(((string)(">")));
                        if (this.pretty)
                        {
                                                                #line 77 "/opt/haxe/std/haxe/xml/Printer.hx"
                            this.output.b.Append(((string)("\n")));
                        }

                                                        #line 78 "/opt/haxe/std/haxe/xml/Printer.hx"
                        {
                                                                #line 78 "/opt/haxe/std/haxe/xml/Printer.hx"
                            if (((@value.nodeType != global::Xml.Document) && (@value.nodeType != global::Xml.Element)))
                            {
                                                                        #line 78 "/opt/haxe/std/haxe/xml/Printer.hx"
                                throw ((global::System.Exception)(global::haxe.Exception.thrown(global::haxe.lang.Runtime.concat("Bad node type, expected Element or Document but found ", global::_Xml.XmlType_Impl_.toString(@value.nodeType)))));
                            }

                                                                #line 78 "/opt/haxe/std/haxe/xml/Printer.hx"
                            int _g_current = 0;
                                                                #line 78 "/opt/haxe/std/haxe/xml/Printer.hx"
                            global::Array <object> _g_array = @value.children;
                                                                #line 78 "/opt/haxe/std/haxe/xml/Printer.hx"
                            while ((_g_current < _g_array.length))
                            {
                                                                        #line 78 "/opt/haxe/std/haxe/xml/Printer.hx"
                                global::Xml child = ((global::Xml)(_g_array[_g_current++]));
                                this.writeNode(child, ((this.pretty) ? (global::haxe.lang.Runtime.concat(tabs, "\t")) : (tabs)));
                            }
                        }

                                                        #line 81 "/opt/haxe/std/haxe/xml/Printer.hx"
                        this.output.b.Append(((string)(global::Std.@string(global::haxe.lang.Runtime.concat(tabs, "</")))));
                        {
                                                                #line 82 "/opt/haxe/std/haxe/xml/Printer.hx"
                            if ((@value.nodeType != global::Xml.Element))
                            {
                                                                        #line 82 "/opt/haxe/std/haxe/xml/Printer.hx"
                                throw ((global::System.Exception)(global::haxe.Exception.thrown(global::haxe.lang.Runtime.concat("Bad node type, expected Element but found ", global::_Xml.XmlType_Impl_.toString(@value.nodeType)))));
                            }

                                                                #line 82 "/opt/haxe/std/haxe/xml/Printer.hx"
                            this.output.b.Append(((string)(global::Std.@string(@value.nodeName))));
                        }

                                                        #line 83 "/opt/haxe/std/haxe/xml/Printer.hx"
                        this.output.b.Append(((string)(">")));
                        if (this.pretty)
                        {
                                                                #line 84 "/opt/haxe/std/haxe/xml/Printer.hx"
                            this.output.b.Append(((string)("\n")));
                        }
                    }
                    else
                    {
                                                        #line 86 "/opt/haxe/std/haxe/xml/Printer.hx"
                        this.output.b.Append(((string)("/>")));
                        if (this.pretty)
                        {
                                                                #line 87 "/opt/haxe/std/haxe/xml/Printer.hx"
                            this.output.b.Append(((string)("\n")));
                        }
                    }

                                                #line 67 "/opt/haxe/std/haxe/xml/Printer.hx"
                    break;
                }


                case 1:
                {
                                                #line 90 "/opt/haxe/std/haxe/xml/Printer.hx"
                    if (((@value.nodeType == global::Xml.Document) || (@value.nodeType == global::Xml.Element)))
                    {
                                                        #line 90 "/opt/haxe/std/haxe/xml/Printer.hx"
                        throw ((global::System.Exception)(global::haxe.Exception.thrown(global::haxe.lang.Runtime.concat("Bad node type, unexpected ", global::_Xml.XmlType_Impl_.toString(@value.nodeType)))));
                    }

                                                #line 90 "/opt/haxe/std/haxe/xml/Printer.hx"
                    string nodeValue = @value.nodeValue;
                    if ((nodeValue.Length != 0))
                    {
                                                        #line 92 "/opt/haxe/std/haxe/xml/Printer.hx"
                        {
                                                                #line 92 "/opt/haxe/std/haxe/xml/Printer.hx"
                            string input1 = global::haxe.lang.Runtime.concat(tabs, global::StringTools.htmlEscape(nodeValue, default(global::haxe.lang.Null <bool>)));
                                                                #line 92 "/opt/haxe/std/haxe/xml/Printer.hx"
                            this.output.b.Append(((string)(global::Std.@string(input1))));
                        }

                                                        #line 93 "/opt/haxe/std/haxe/xml/Printer.hx"
                        if (this.pretty)
                        {
                                                                #line 93 "/opt/haxe/std/haxe/xml/Printer.hx"
                            this.output.b.Append(((string)("\n")));
                        }
                    }

                                                #line 89 "/opt/haxe/std/haxe/xml/Printer.hx"
                    break;
                }


                case 2:
                {
                                                #line 52 "/opt/haxe/std/haxe/xml/Printer.hx"
                    this.output.b.Append(((string)(global::Std.@string(global::haxe.lang.Runtime.concat(tabs, "<![CDATA[")))));
                    {
                                                        #line 53 "/opt/haxe/std/haxe/xml/Printer.hx"
                        if (((@value.nodeType == global::Xml.Document) || (@value.nodeType == global::Xml.Element)))
                        {
                                                                #line 53 "/opt/haxe/std/haxe/xml/Printer.hx"
                            throw ((global::System.Exception)(global::haxe.Exception.thrown(global::haxe.lang.Runtime.concat("Bad node type, unexpected ", global::_Xml.XmlType_Impl_.toString(@value.nodeType)))));
                        }

                                                        #line 53 "/opt/haxe/std/haxe/xml/Printer.hx"
                        this.output.b.Append(((string)(global::Std.@string(@value.nodeValue))));
                    }

                                                #line 54 "/opt/haxe/std/haxe/xml/Printer.hx"
                    this.output.b.Append(((string)("]]>")));
                    if (this.pretty)
                    {
                                                        #line 55 "/opt/haxe/std/haxe/xml/Printer.hx"
                        this.output.b.Append(((string)("\n")));
                    }

                                                #line 51 "/opt/haxe/std/haxe/xml/Printer.hx"
                    break;
                }


                case 3:
                {
                                                #line 57 "/opt/haxe/std/haxe/xml/Printer.hx"
                    if (((@value.nodeType == global::Xml.Document) || (@value.nodeType == global::Xml.Element)))
                    {
                                                        #line 57 "/opt/haxe/std/haxe/xml/Printer.hx"
                        throw ((global::System.Exception)(global::haxe.Exception.thrown(global::haxe.lang.Runtime.concat("Bad node type, unexpected ", global::_Xml.XmlType_Impl_.toString(@value.nodeType)))));
                    }

                                                #line 57 "/opt/haxe/std/haxe/xml/Printer.hx"
                    string commentContent = @value.nodeValue;
                    commentContent = new global::EReg("[\n\r\t]+", "g").replace(commentContent, "");
                                                #line 59 "/opt/haxe/std/haxe/xml/Printer.hx"
                    commentContent = global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat("<!--", commentContent), "-->");
                    this.output.b.Append(((string)(global::Std.@string(tabs))));
                                                #line 61 "/opt/haxe/std/haxe/xml/Printer.hx"
                    {
                                                        #line 61 "/opt/haxe/std/haxe/xml/Printer.hx"
                        string input2 = commentContent.Trim();
                                                        #line 61 "/opt/haxe/std/haxe/xml/Printer.hx"
                        this.output.b.Append(((string)(global::Std.@string(input2))));
                    }

                                                #line 62 "/opt/haxe/std/haxe/xml/Printer.hx"
                    if (this.pretty)
                    {
                                                        #line 62 "/opt/haxe/std/haxe/xml/Printer.hx"
                        this.output.b.Append(((string)("\n")));
                    }

                                                #line 56 "/opt/haxe/std/haxe/xml/Printer.hx"
                    break;
                }


                case 4:
                {
                                                #line 99 "/opt/haxe/std/haxe/xml/Printer.hx"
                    {
                                                        #line 99 "/opt/haxe/std/haxe/xml/Printer.hx"
                        if (((@value.nodeType == global::Xml.Document) || (@value.nodeType == global::Xml.Element)))
                        {
                                                                #line 99 "/opt/haxe/std/haxe/xml/Printer.hx"
                            throw ((global::System.Exception)(global::haxe.Exception.thrown(global::haxe.lang.Runtime.concat("Bad node type, unexpected ", global::_Xml.XmlType_Impl_.toString(@value.nodeType)))));
                        }

                                                        #line 99 "/opt/haxe/std/haxe/xml/Printer.hx"
                        this.output.b.Append(((string)(global::Std.@string(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat("<!DOCTYPE ", @value.nodeValue), ">")))));
                    }

                                                #line 100 "/opt/haxe/std/haxe/xml/Printer.hx"
                    if (this.pretty)
                    {
                                                        #line 100 "/opt/haxe/std/haxe/xml/Printer.hx"
                        this.output.b.Append(((string)("\n")));
                    }

                                                #line 98 "/opt/haxe/std/haxe/xml/Printer.hx"
                    break;
                }


                case 5:
                {
                                                #line 96 "/opt/haxe/std/haxe/xml/Printer.hx"
                    {
                                                        #line 96 "/opt/haxe/std/haxe/xml/Printer.hx"
                        if (((@value.nodeType == global::Xml.Document) || (@value.nodeType == global::Xml.Element)))
                        {
                                                                #line 96 "/opt/haxe/std/haxe/xml/Printer.hx"
                            throw ((global::System.Exception)(global::haxe.Exception.thrown(global::haxe.lang.Runtime.concat("Bad node type, unexpected ", global::_Xml.XmlType_Impl_.toString(@value.nodeType)))));
                        }

                                                        #line 96 "/opt/haxe/std/haxe/xml/Printer.hx"
                        this.output.b.Append(((string)(global::Std.@string(global::haxe.lang.Runtime.concat(global::haxe.lang.Runtime.concat("<?", @value.nodeValue), "?>")))));
                    }

                                                #line 97 "/opt/haxe/std/haxe/xml/Printer.hx"
                    if (this.pretty)
                    {
                                                        #line 97 "/opt/haxe/std/haxe/xml/Printer.hx"
                        this.output.b.Append(((string)("\n")));
                    }

                                                #line 95 "/opt/haxe/std/haxe/xml/Printer.hx"
                    break;
                }


                case 6:
                {
                                                #line 64 "/opt/haxe/std/haxe/xml/Printer.hx"
                    if (((@value.nodeType != global::Xml.Document) && (@value.nodeType != global::Xml.Element)))
                    {
                                                        #line 64 "/opt/haxe/std/haxe/xml/Printer.hx"
                        throw ((global::System.Exception)(global::haxe.Exception.thrown(global::haxe.lang.Runtime.concat("Bad node type, expected Element or Document but found ", global::_Xml.XmlType_Impl_.toString(@value.nodeType)))));
                    }

                                                #line 64 "/opt/haxe/std/haxe/xml/Printer.hx"
                    int _g_current1 = 0;
                                                #line 64 "/opt/haxe/std/haxe/xml/Printer.hx"
                    global::Array <object> _g_array1 = @value.children;
                                                #line 64 "/opt/haxe/std/haxe/xml/Printer.hx"
                    while ((_g_current1 < _g_array1.length))
                    {
                                                        #line 64 "/opt/haxe/std/haxe/xml/Printer.hx"
                        global::Xml child1 = ((global::Xml)(_g_array1[_g_current1++]));
                        this.writeNode(child1, tabs);
                    }

                                                #line 64 "/opt/haxe/std/haxe/xml/Printer.hx"
                    break;
                }
                }
            }
                        #line default
        }
Пример #8
0
    private static void __hx_ctor__EReg(global::EReg __hx_this, string r, string opt)
    {
        unchecked {
                        #line 35 "/opt/haxe/std/cs/_std/EReg.hx"
            int opts = ((int)(global::haxe.lang.Runtime.toInt(((object)(global::System.Text.RegularExpressions.RegexOptions.CultureInvariant)))));
            {
                                #line 36 "/opt/haxe/std/cs/_std/EReg.hx"
                int _g = 0;
                                #line 36 "/opt/haxe/std/cs/_std/EReg.hx"
                int _g1 = opt.Length;
                                #line 36 "/opt/haxe/std/cs/_std/EReg.hx"
                while ((_g < _g1))
                {
                                        #line 36 "/opt/haxe/std/cs/_std/EReg.hx"
                    int i = _g++;
                                        #line 38 "/opt/haxe/std/cs/_std/EReg.hx"
                    switch (((int)(opt[i])))
                    {
                    case 99:
                    {
                                                        #line 47 "/opt/haxe/std/cs/_std/EReg.hx"
                        opts |= ((int)(global::haxe.lang.Runtime.toInt(((object)(global::System.Text.RegularExpressions.RegexOptions.Compiled)))));
                                                        #line 47 "/opt/haxe/std/cs/_std/EReg.hx"
                        break;
                    }


                    case 103:
                    {
                                                        #line 42 "/opt/haxe/std/cs/_std/EReg.hx"
                        __hx_this.isGlobal = true;
                                                        #line 42 "/opt/haxe/std/cs/_std/EReg.hx"
                        break;
                    }


                    case 105:
                    {
                                                        #line 40 "/opt/haxe/std/cs/_std/EReg.hx"
                        opts |= ((int)(global::haxe.lang.Runtime.toInt(((object)(global::System.Text.RegularExpressions.RegexOptions.IgnoreCase)))));
                                                        #line 40 "/opt/haxe/std/cs/_std/EReg.hx"
                        break;
                    }


                    case 109:
                    {
                                                        #line 44 "/opt/haxe/std/cs/_std/EReg.hx"
                        opts |= ((int)(global::haxe.lang.Runtime.toInt(((object)(global::System.Text.RegularExpressions.RegexOptions.Multiline)))));
                                                        #line 44 "/opt/haxe/std/cs/_std/EReg.hx"
                        break;
                    }
                    }
                }
            }

                        #line 52 "/opt/haxe/std/cs/_std/EReg.hx"
            __hx_this.regex = new global::System.Text.RegularExpressions.Regex(((string)(r)), ((global::System.Text.RegularExpressions.RegexOptions)(((object)(opts)))));
        }
                #line default
    }
Пример #9
0
 public static string unescape(string path)
 {
                 #line 325 "/opt/haxe/std/haxe/io/Path.hx"
     global::EReg regex = new global::EReg("-x([0-9][0-9])", "g");
     return(regex.map(path, (((global::haxe.io.Path_unescape_326__Fun.__hx_current != null)) ? (global::haxe.io.Path_unescape_326__Fun.__hx_current) : (global::haxe.io.Path_unescape_326__Fun.__hx_current = ((global::haxe.io.Path_unescape_326__Fun)(new global::haxe.io.Path_unescape_326__Fun()))))));
 }
Пример #10
0
        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);
            }
        }