// This file was generated automatically by the Snowball to JSX compiler

import "base-stemmer.jsx";
import "among.jsx";

 /**
  * This class was automatically generated by a Snowball to JSX compiler
  * It implements the stemming algorithm defined by a snowball script.
  */

__export__ class PortugueseStemmer extends BaseStemmer
{
    static const serialVersionUID = 1;
    static const methodObject = new PortugueseStemmer();

    static const a_0 = [
        new Among("", -1, 3),
        new Among("\u00E3", 0, 1),
        new Among("\u00F5", 0, 2)
    ];

    static const a_1 = [
        new Among("", -1, 3),
        new Among("a~", 0, 1),
        new Among("o~", 0, 2)
    ];

    static const a_2 = [
        new Among("ic", -1, -1),
        new Among("ad", -1, -1),
        new Among("os", -1, -1),
        new Among("iv", -1, 1)
    ];

    static const a_3 = [
        new Among("ante", -1, 1),
        new Among("avel", -1, 1),
        new Among("\u00EDvel", -1, 1)
    ];

    static const a_4 = [
        new Among("ic", -1, 1),
        new Among("abil", -1, 1),
        new Among("iv", -1, 1)
    ];

    static const a_5 = [
        new Among("ica", -1, 1),
        new Among("\u00E2ncia", -1, 1),
        new Among("\u00EAncia", -1, 4),
        new Among("ira", -1, 9),
        new Among("adora", -1, 1),
        new Among("osa", -1, 1),
        new Among("ista", -1, 1),
        new Among("iva", -1, 8),
        new Among("eza", -1, 1),
        new Among("log\u00EDa", -1, 2),
        new Among("idade", -1, 7),
        new Among("ante", -1, 1),
        new Among("mente", -1, 6),
        new Among("amente", 12, 5),
        new Among("\u00E1vel", -1, 1),
        new Among("\u00EDvel", -1, 1),
        new Among("uci\u00F3n", -1, 3),
        new Among("ico", -1, 1),
        new Among("ismo", -1, 1),
        new Among("oso", -1, 1),
        new Among("amento", -1, 1),
        new Among("imento", -1, 1),
        new Among("ivo", -1, 8),
        new Among("a\u00E7a~o", -1, 1),
        new Among("ador", -1, 1),
        new Among("icas", -1, 1),
        new Among("\u00EAncias", -1, 4),
        new Among("iras", -1, 9),
        new Among("adoras", -1, 1),
        new Among("osas", -1, 1),
        new Among("istas", -1, 1),
        new Among("ivas", -1, 8),
        new Among("ezas", -1, 1),
        new Among("log\u00EDas", -1, 2),
        new Among("idades", -1, 7),
        new Among("uciones", -1, 3),
        new Among("adores", -1, 1),
        new Among("antes", -1, 1),
        new Among("a\u00E7o~es", -1, 1),
        new Among("icos", -1, 1),
        new Among("ismos", -1, 1),
        new Among("osos", -1, 1),
        new Among("amentos", -1, 1),
        new Among("imentos", -1, 1),
        new Among("ivos", -1, 8)
    ];

    static const a_6 = [
        new Among("ada", -1, 1),
        new Among("ida", -1, 1),
        new Among("ia", -1, 1),
        new Among("aria", 2, 1),
        new Among("eria", 2, 1),
        new Among("iria", 2, 1),
        new Among("ara", -1, 1),
        new Among("era", -1, 1),
        new Among("ira", -1, 1),
        new Among("ava", -1, 1),
        new Among("asse", -1, 1),
        new Among("esse", -1, 1),
        new Among("isse", -1, 1),
        new Among("aste", -1, 1),
        new Among("este", -1, 1),
        new Among("iste", -1, 1),
        new Among("ei", -1, 1),
        new Among("arei", 16, 1),
        new Among("erei", 16, 1),
        new Among("irei", 16, 1),
        new Among("am", -1, 1),
        new Among("iam", 20, 1),
        new Among("ariam", 21, 1),
        new Among("eriam", 21, 1),
        new Among("iriam", 21, 1),
        new Among("aram", 20, 1),
        new Among("eram", 20, 1),
        new Among("iram", 20, 1),
        new Among("avam", 20, 1),
        new Among("em", -1, 1),
        new Among("arem", 29, 1),
        new Among("erem", 29, 1),
        new Among("irem", 29, 1),
        new Among("assem", 29, 1),
        new Among("essem", 29, 1),
        new Among("issem", 29, 1),
        new Among("ado", -1, 1),
        new Among("ido", -1, 1),
        new Among("ando", -1, 1),
        new Among("endo", -1, 1),
        new Among("indo", -1, 1),
        new Among("ara~o", -1, 1),
        new Among("era~o", -1, 1),
        new Among("ira~o", -1, 1),
        new Among("ar", -1, 1),
        new Among("er", -1, 1),
        new Among("ir", -1, 1),
        new Among("as", -1, 1),
        new Among("adas", 47, 1),
        new Among("idas", 47, 1),
        new Among("ias", 47, 1),
        new Among("arias", 50, 1),
        new Among("erias", 50, 1),
        new Among("irias", 50, 1),
        new Among("aras", 47, 1),
        new Among("eras", 47, 1),
        new Among("iras", 47, 1),
        new Among("avas", 47, 1),
        new Among("es", -1, 1),
        new Among("ardes", 58, 1),
        new Among("erdes", 58, 1),
        new Among("irdes", 58, 1),
        new Among("ares", 58, 1),
        new Among("eres", 58, 1),
        new Among("ires", 58, 1),
        new Among("asses", 58, 1),
        new Among("esses", 58, 1),
        new Among("isses", 58, 1),
        new Among("astes", 58, 1),
        new Among("estes", 58, 1),
        new Among("istes", 58, 1),
        new Among("is", -1, 1),
        new Among("ais", 71, 1),
        new Among("eis", 71, 1),
        new Among("areis", 73, 1),
        new Among("ereis", 73, 1),
        new Among("ireis", 73, 1),
        new Among("\u00E1reis", 73, 1),
        new Among("\u00E9reis", 73, 1),
        new Among("\u00EDreis", 73, 1),
        new Among("\u00E1sseis", 73, 1),
        new Among("\u00E9sseis", 73, 1),
        new Among("\u00EDsseis", 73, 1),
        new Among("\u00E1veis", 73, 1),
        new Among("\u00EDeis", 73, 1),
        new Among("ar\u00EDeis", 84, 1),
        new Among("er\u00EDeis", 84, 1),
        new Among("ir\u00EDeis", 84, 1),
        new Among("ados", -1, 1),
        new Among("idos", -1, 1),
        new Among("amos", -1, 1),
        new Among("\u00E1ramos", 90, 1),
        new Among("\u00E9ramos", 90, 1),
        new Among("\u00EDramos", 90, 1),
        new Among("\u00E1vamos", 90, 1),
        new Among("\u00EDamos", 90, 1),
        new Among("ar\u00EDamos", 95, 1),
        new Among("er\u00EDamos", 95, 1),
        new Among("ir\u00EDamos", 95, 1),
        new Among("emos", -1, 1),
        new Among("aremos", 99, 1),
        new Among("eremos", 99, 1),
        new Among("iremos", 99, 1),
        new Among("\u00E1ssemos", 99, 1),
        new Among("\u00EAssemos", 99, 1),
        new Among("\u00EDssemos", 99, 1),
        new Among("imos", -1, 1),
        new Among("armos", -1, 1),
        new Among("ermos", -1, 1),
        new Among("irmos", -1, 1),
        new Among("\u00E1mos", -1, 1),
        new Among("ar\u00E1s", -1, 1),
        new Among("er\u00E1s", -1, 1),
        new Among("ir\u00E1s", -1, 1),
        new Among("eu", -1, 1),
        new Among("iu", -1, 1),
        new Among("ou", -1, 1),
        new Among("ar\u00E1", -1, 1),
        new Among("er\u00E1", -1, 1),
        new Among("ir\u00E1", -1, 1)
    ];

    static const a_7 = [
        new Among("a", -1, 1),
        new Among("i", -1, 1),
        new Among("o", -1, 1),
        new Among("os", -1, 1),
        new Among("\u00E1", -1, 1),
        new Among("\u00ED", -1, 1),
        new Among("\u00F3", -1, 1)
    ];

    static const a_8 = [
        new Among("e", -1, 1),
        new Among("\u00E7", -1, 2),
        new Among("\u00E9", -1, 1),
        new Among("\u00EA", -1, 1)
    ];

    static const g_v = [17, 65, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 19, 12, 2] : int[];

    var I_p2 : int = 0;
    var I_p1 : int = 0;
    var I_pV : int = 0;

    function copy_from (other : PortugueseStemmer) : void
    {
        this.I_p2 = other.I_p2;
        this.I_p1 = other.I_p1;
        this.I_pV = other.I_pV;
        super.copy_from(other);
    }

    function r_prelude () : boolean
    {
        var among_var : int;
        var v_1 : int;
        // repeat, line 36
        replab0: while(true)
        {
            v_1 = this.cursor;
            var lab1 = true;
            lab1: while (lab1 == true)
            {
                lab1 = false;
                // (, line 36
                // [, line 37
                this.bra = this.cursor;
                // substring, line 37
                among_var = this.find_among(PortugueseStemmer.a_0, 3);
                if (among_var == 0)
                {
                    break lab1;
                }
                // ], line 37
                this.ket = this.cursor;
                switch (among_var) {
                    case 0:
                        break lab1;
                    case 1:
                        // (, line 38
                        // <-, line 38
                        if (!this.slice_from("a~"))
                        {
                            return false;
                        }
                        break;
                    case 2:
                        // (, line 39
                        // <-, line 39
                        if (!this.slice_from("o~"))
                        {
                            return false;
                        }
                        break;
                    case 3:
                        // (, line 40
                        // next, line 40
                        if (this.cursor >= this.limit)
                        {
                            break lab1;
                        }
                        this.cursor++;
                        break;
                }
                continue replab0;
            }
            this.cursor = v_1;
            break replab0;
        }
        return true;
    }

    function r_mark_regions () : boolean
    {
        var v_1 : int;
        var v_2 : int;
        var v_3 : int;
        var v_6 : int;
        var v_8 : int;
        // (, line 44
        this.I_pV = this.limit;
        this.I_p1 = this.limit;
        this.I_p2 = this.limit;
        // do, line 50
        v_1 = this.cursor;
        var lab0 = true;
        lab0: while (lab0 == true)
        {
            lab0 = false;
            // (, line 50
            // or, line 52
            var lab1 = true;
            lab1: while (lab1 == true)
            {
                lab1 = false;
                v_2 = this.cursor;
                var lab2 = true;
                lab2: while (lab2 == true)
                {
                    lab2 = false;
                    // (, line 51
                    if (!(this.in_grouping(PortugueseStemmer.g_v, 97, 250)))
                    {
                        break lab2;
                    }
                    // or, line 51
                    var lab3 = true;
                    lab3: while (lab3 == true)
                    {
                        lab3 = false;
                        v_3 = this.cursor;
                        var lab4 = true;
                        lab4: while (lab4 == true)
                        {
                            lab4 = false;
                            // (, line 51
                            if (!(this.out_grouping(PortugueseStemmer.g_v, 97, 250)))
                            {
                                break lab4;
                            }
                            // gopast, line 51
                            golab5: while(true)
                            {
                                var lab6 = true;
                                lab6: while (lab6 == true)
                                {
                                    lab6 = false;
                                    if (!(this.in_grouping(PortugueseStemmer.g_v, 97, 250)))
                                    {
                                        break lab6;
                                    }
                                    break golab5;
                                }
                                if (this.cursor >= this.limit)
                                {
                                    break lab4;
                                }
                                this.cursor++;
                            }
                            break lab3;
                        }
                        this.cursor = v_3;
                        // (, line 51
                        if (!(this.in_grouping(PortugueseStemmer.g_v, 97, 250)))
                        {
                            break lab2;
                        }
                        // gopast, line 51
                        golab7: while(true)
                        {
                            var lab8 = true;
                            lab8: while (lab8 == true)
                            {
                                lab8 = false;
                                if (!(this.out_grouping(PortugueseStemmer.g_v, 97, 250)))
                                {
                                    break lab8;
                                }
                                break golab7;
                            }
                            if (this.cursor >= this.limit)
                            {
                                break lab2;
                            }
                            this.cursor++;
                        }
                    }
                    break lab1;
                }
                this.cursor = v_2;
                // (, line 53
                if (!(this.out_grouping(PortugueseStemmer.g_v, 97, 250)))
                {
                    break lab0;
                }
                // or, line 53
                var lab9 = true;
                lab9: while (lab9 == true)
                {
                    lab9 = false;
                    v_6 = this.cursor;
                    var lab10 = true;
                    lab10: while (lab10 == true)
                    {
                        lab10 = false;
                        // (, line 53
                        if (!(this.out_grouping(PortugueseStemmer.g_v, 97, 250)))
                        {
                            break lab10;
                        }
                        // gopast, line 53
                        golab11: while(true)
                        {
                            var lab12 = true;
                            lab12: while (lab12 == true)
                            {
                                lab12 = false;
                                if (!(this.in_grouping(PortugueseStemmer.g_v, 97, 250)))
                                {
                                    break lab12;
                                }
                                break golab11;
                            }
                            if (this.cursor >= this.limit)
                            {
                                break lab10;
                            }
                            this.cursor++;
                        }
                        break lab9;
                    }
                    this.cursor = v_6;
                    // (, line 53
                    if (!(this.in_grouping(PortugueseStemmer.g_v, 97, 250)))
                    {
                        break lab0;
                    }
                    // next, line 53
                    if (this.cursor >= this.limit)
                    {
                        break lab0;
                    }
                    this.cursor++;
                }
            }
            // setmark pV, line 54
            this.I_pV = this.cursor;
        }
        this.cursor = v_1;
        // do, line 56
        v_8 = this.cursor;
        var lab13 = true;
        lab13: while (lab13 == true)
        {
            lab13 = false;
            // (, line 56
            // gopast, line 57
            golab14: while(true)
            {
                var lab15 = true;
                lab15: while (lab15 == true)
                {
                    lab15 = false;
                    if (!(this.in_grouping(PortugueseStemmer.g_v, 97, 250)))
                    {
                        break lab15;
                    }
                    break golab14;
                }
                if (this.cursor >= this.limit)
                {
                    break lab13;
                }
                this.cursor++;
            }
            // gopast, line 57
            golab16: while(true)
            {
                var lab17 = true;
                lab17: while (lab17 == true)
                {
                    lab17 = false;
                    if (!(this.out_grouping(PortugueseStemmer.g_v, 97, 250)))
                    {
                        break lab17;
                    }
                    break golab16;
                }
                if (this.cursor >= this.limit)
                {
                    break lab13;
                }
                this.cursor++;
            }
            // setmark p1, line 57
            this.I_p1 = this.cursor;
            // gopast, line 58
            golab18: while(true)
            {
                var lab19 = true;
                lab19: while (lab19 == true)
                {
                    lab19 = false;
                    if (!(this.in_grouping(PortugueseStemmer.g_v, 97, 250)))
                    {
                        break lab19;
                    }
                    break golab18;
                }
                if (this.cursor >= this.limit)
                {
                    break lab13;
                }
                this.cursor++;
            }
            // gopast, line 58
            golab20: while(true)
            {
                var lab21 = true;
                lab21: while (lab21 == true)
                {
                    lab21 = false;
                    if (!(this.out_grouping(PortugueseStemmer.g_v, 97, 250)))
                    {
                        break lab21;
                    }
                    break golab20;
                }
                if (this.cursor >= this.limit)
                {
                    break lab13;
                }
                this.cursor++;
            }
            // setmark p2, line 58
            this.I_p2 = this.cursor;
        }
        this.cursor = v_8;
        return true;
    }

    function r_postlude () : boolean
    {
        var among_var : int;
        var v_1 : int;
        // repeat, line 62
        replab0: while(true)
        {
            v_1 = this.cursor;
            var lab1 = true;
            lab1: while (lab1 == true)
            {
                lab1 = false;
                // (, line 62
                // [, line 63
                this.bra = this.cursor;
                // substring, line 63
                among_var = this.find_among(PortugueseStemmer.a_1, 3);
                if (among_var == 0)
                {
                    break lab1;
                }
                // ], line 63
                this.ket = this.cursor;
                switch (among_var) {
                    case 0:
                        break lab1;
                    case 1:
                        // (, line 64
                        // <-, line 64
                        if (!this.slice_from("\u00E3"))
                        {
                            return false;
                        }
                        break;
                    case 2:
                        // (, line 65
                        // <-, line 65
                        if (!this.slice_from("\u00F5"))
                        {
                            return false;
                        }
                        break;
                    case 3:
                        // (, line 66
                        // next, line 66
                        if (this.cursor >= this.limit)
                        {
                            break lab1;
                        }
                        this.cursor++;
                        break;
                }
                continue replab0;
            }
            this.cursor = v_1;
            break replab0;
        }
        return true;
    }

    function r_RV () : boolean
    {
        if (!(this.I_pV <= this.cursor))
        {
            return false;
        }
        return true;
    }

    function r_R1 () : boolean
    {
        if (!(this.I_p1 <= this.cursor))
        {
            return false;
        }
        return true;
    }

    function r_R2 () : boolean
    {
        if (!(this.I_p2 <= this.cursor))
        {
            return false;
        }
        return true;
    }

    function r_standard_suffix () : boolean
    {
        var among_var : int;
        var v_1 : int;
        var v_2 : int;
        var v_3 : int;
        var v_4 : int;
        // (, line 76
        // [, line 77
        this.ket = this.cursor;
        // substring, line 77
        among_var = this.find_among_b(PortugueseStemmer.a_5, 45);
        if (among_var == 0)
        {
            return false;
        }
        // ], line 77
        this.bra = this.cursor;
        switch (among_var) {
            case 0:
                return false;
            case 1:
                // (, line 92
                // call R2, line 93
                if (!this.r_R2())
                {
                    return false;
                }
                // delete, line 93
                if (!this.slice_del())
                {
                    return false;
                }
                break;
            case 2:
                // (, line 97
                // call R2, line 98
                if (!this.r_R2())
                {
                    return false;
                }
                // <-, line 98
                if (!this.slice_from("log"))
                {
                    return false;
                }
                break;
            case 3:
                // (, line 101
                // call R2, line 102
                if (!this.r_R2())
                {
                    return false;
                }
                // <-, line 102
                if (!this.slice_from("u"))
                {
                    return false;
                }
                break;
            case 4:
                // (, line 105
                // call R2, line 106
                if (!this.r_R2())
                {
                    return false;
                }
                // <-, line 106
                if (!this.slice_from("ente"))
                {
                    return false;
                }
                break;
            case 5:
                // (, line 109
                // call R1, line 110
                if (!this.r_R1())
                {
                    return false;
                }
                // delete, line 110
                if (!this.slice_del())
                {
                    return false;
                }
                // try, line 111
                v_1 = this.limit - this.cursor;
                var lab0 = true;
                lab0: while (lab0 == true)
                {
                    lab0 = false;
                    // (, line 111
                    // [, line 112
                    this.ket = this.cursor;
                    // substring, line 112
                    among_var = this.find_among_b(PortugueseStemmer.a_2, 4);
                    if (among_var == 0)
                    {
                        this.cursor = this.limit - v_1;
                        break lab0;
                    }
                    // ], line 112
                    this.bra = this.cursor;
                    // call R2, line 112
                    if (!this.r_R2())
                    {
                        this.cursor = this.limit - v_1;
                        break lab0;
                    }
                    // delete, line 112
                    if (!this.slice_del())
                    {
                        return false;
                    }
                    switch (among_var) {
                        case 0:
                            this.cursor = this.limit - v_1;
                            break lab0;
                        case 1:
                            // (, line 113
                            // [, line 113
                            this.ket = this.cursor;
                            // literal, line 113
                            if (!(this.eq_s_b(2, "at")))
                            {
                                this.cursor = this.limit - v_1;
                                break lab0;
                            }
                            // ], line 113
                            this.bra = this.cursor;
                            // call R2, line 113
                            if (!this.r_R2())
                            {
                                this.cursor = this.limit - v_1;
                                break lab0;
                            }
                            // delete, line 113
                            if (!this.slice_del())
                            {
                                return false;
                            }
                            break;
                    }
                }
                break;
            case 6:
                // (, line 121
                // call R2, line 122
                if (!this.r_R2())
                {
                    return false;
                }
                // delete, line 122
                if (!this.slice_del())
                {
                    return false;
                }
                // try, line 123
                v_2 = this.limit - this.cursor;
                var lab1 = true;
                lab1: while (lab1 == true)
                {
                    lab1 = false;
                    // (, line 123
                    // [, line 124
                    this.ket = this.cursor;
                    // substring, line 124
                    among_var = this.find_among_b(PortugueseStemmer.a_3, 3);
                    if (among_var == 0)
                    {
                        this.cursor = this.limit - v_2;
                        break lab1;
                    }
                    // ], line 124
                    this.bra = this.cursor;
                    switch (among_var) {
                        case 0:
                            this.cursor = this.limit - v_2;
                            break lab1;
                        case 1:
                            // (, line 127
                            // call R2, line 127
                            if (!this.r_R2())
                            {
                                this.cursor = this.limit - v_2;
                                break lab1;
                            }
                            // delete, line 127
                            if (!this.slice_del())
                            {
                                return false;
                            }
                            break;
                    }
                }
                break;
            case 7:
                // (, line 133
                // call R2, line 134
                if (!this.r_R2())
                {
                    return false;
                }
                // delete, line 134
                if (!this.slice_del())
                {
                    return false;
                }
                // try, line 135
                v_3 = this.limit - this.cursor;
                var lab2 = true;
                lab2: while (lab2 == true)
                {
                    lab2 = false;
                    // (, line 135
                    // [, line 136
                    this.ket = this.cursor;
                    // substring, line 136
                    among_var = this.find_among_b(PortugueseStemmer.a_4, 3);
                    if (among_var == 0)
                    {
                        this.cursor = this.limit - v_3;
                        break lab2;
                    }
                    // ], line 136
                    this.bra = this.cursor;
                    switch (among_var) {
                        case 0:
                            this.cursor = this.limit - v_3;
                            break lab2;
                        case 1:
                            // (, line 139
                            // call R2, line 139
                            if (!this.r_R2())
                            {
                                this.cursor = this.limit - v_3;
                                break lab2;
                            }
                            // delete, line 139
                            if (!this.slice_del())
                            {
                                return false;
                            }
                            break;
                    }
                }
                break;
            case 8:
                // (, line 145
                // call R2, line 146
                if (!this.r_R2())
                {
                    return false;
                }
                // delete, line 146
                if (!this.slice_del())
                {
                    return false;
                }
                // try, line 147
                v_4 = this.limit - this.cursor;
                var lab3 = true;
                lab3: while (lab3 == true)
                {
                    lab3 = false;
                    // (, line 147
                    // [, line 148
                    this.ket = this.cursor;
                    // literal, line 148
                    if (!(this.eq_s_b(2, "at")))
                    {
                        this.cursor = this.limit - v_4;
                        break lab3;
                    }
                    // ], line 148
                    this.bra = this.cursor;
                    // call R2, line 148
                    if (!this.r_R2())
                    {
                        this.cursor = this.limit - v_4;
                        break lab3;
                    }
                    // delete, line 148
                    if (!this.slice_del())
                    {
                        return false;
                    }
                }
                break;
            case 9:
                // (, line 152
                // call RV, line 153
                if (!this.r_RV())
                {
                    return false;
                }
                // literal, line 153
                if (!(this.eq_s_b(1, "e")))
                {
                    return false;
                }
                // <-, line 154
                if (!this.slice_from("ir"))
                {
                    return false;
                }
                break;
        }
        return true;
    }

    function r_verb_suffix () : boolean
    {
        var among_var : int;
        var v_1 : int;
        var v_2 : int;
        // setlimit, line 159
        v_1 = this.limit - this.cursor;
        // tomark, line 159
        if (this.cursor < this.I_pV)
        {
            return false;
        }
        this.cursor = this.I_pV;
        v_2 = this.limit_backward;
        this.limit_backward = this.cursor;
        this.cursor = this.limit - v_1;
        // (, line 159
        // [, line 160
        this.ket = this.cursor;
        // substring, line 160
        among_var = this.find_among_b(PortugueseStemmer.a_6, 120);
        if (among_var == 0)
        {
            this.limit_backward = v_2;
            return false;
        }
        // ], line 160
        this.bra = this.cursor;
        switch (among_var) {
            case 0:
                this.limit_backward = v_2;
                return false;
            case 1:
                // (, line 179
                // delete, line 179
                if (!this.slice_del())
                {
                    return false;
                }
                break;
        }
        this.limit_backward = v_2;
        return true;
    }

    function r_residual_suffix () : boolean
    {
        var among_var : int;
        // (, line 183
        // [, line 184
        this.ket = this.cursor;
        // substring, line 184
        among_var = this.find_among_b(PortugueseStemmer.a_7, 7);
        if (among_var == 0)
        {
            return false;
        }
        // ], line 184
        this.bra = this.cursor;
        switch (among_var) {
            case 0:
                return false;
            case 1:
                // (, line 187
                // call RV, line 187
                if (!this.r_RV())
                {
                    return false;
                }
                // delete, line 187
                if (!this.slice_del())
                {
                    return false;
                }
                break;
        }
        return true;
    }

    function r_residual_form () : boolean
    {
        var among_var : int;
        var v_1 : int;
        var v_2 : int;
        var v_3 : int;
        // (, line 191
        // [, line 192
        this.ket = this.cursor;
        // substring, line 192
        among_var = this.find_among_b(PortugueseStemmer.a_8, 4);
        if (among_var == 0)
        {
            return false;
        }
        // ], line 192
        this.bra = this.cursor;
        switch (among_var) {
            case 0:
                return false;
            case 1:
                // (, line 194
                // call RV, line 194
                if (!this.r_RV())
                {
                    return false;
                }
                // delete, line 194
                if (!this.slice_del())
                {
                    return false;
                }
                // [, line 194
                this.ket = this.cursor;
                // or, line 194
                var lab0 = true;
                lab0: while (lab0 == true)
                {
                    lab0 = false;
                    v_1 = this.limit - this.cursor;
                    var lab1 = true;
                    lab1: while (lab1 == true)
                    {
                        lab1 = false;
                        // (, line 194
                        // literal, line 194
                        if (!(this.eq_s_b(1, "u")))
                        {
                            break lab1;
                        }
                        // ], line 194
                        this.bra = this.cursor;
                        // test, line 194
                        v_2 = this.limit - this.cursor;
                        // literal, line 194
                        if (!(this.eq_s_b(1, "g")))
                        {
                            break lab1;
                        }
                        this.cursor = this.limit - v_2;
                        break lab0;
                    }
                    this.cursor = this.limit - v_1;
                    // (, line 195
                    // literal, line 195
                    if (!(this.eq_s_b(1, "i")))
                    {
                        return false;
                    }
                    // ], line 195
                    this.bra = this.cursor;
                    // test, line 195
                    v_3 = this.limit - this.cursor;
                    // literal, line 195
                    if (!(this.eq_s_b(1, "c")))
                    {
                        return false;
                    }
                    this.cursor = this.limit - v_3;
                }
                // call RV, line 195
                if (!this.r_RV())
                {
                    return false;
                }
                // delete, line 195
                if (!this.slice_del())
                {
                    return false;
                }
                break;
            case 2:
                // (, line 196
                // <-, line 196
                if (!this.slice_from("c"))
                {
                    return false;
                }
                break;
        }
        return true;
    }

    override function stem () : boolean
    {
        var v_1 : int;
        var v_2 : int;
        var v_3 : int;
        var v_4 : int;
        var v_5 : int;
        var v_6 : int;
        var v_7 : int;
        var v_8 : int;
        var v_9 : int;
        var v_10 : int;
        // (, line 201
        // do, line 202
        v_1 = this.cursor;
        var lab0 = true;
        lab0: while (lab0 == true)
        {
            lab0 = false;
            // call prelude, line 202
            if (!this.r_prelude())
            {
                break lab0;
            }
        }
        this.cursor = v_1;
        // do, line 203
        v_2 = this.cursor;
        var lab1 = true;
        lab1: while (lab1 == true)
        {
            lab1 = false;
            // call mark_regions, line 203
            if (!this.r_mark_regions())
            {
                break lab1;
            }
        }
        this.cursor = v_2;
        // backwards, line 204
        this.limit_backward = this.cursor; this.cursor = this.limit;
        // (, line 204
        // do, line 205
        v_3 = this.limit - this.cursor;
        var lab2 = true;
        lab2: while (lab2 == true)
        {
            lab2 = false;
            // (, line 205
            // or, line 209
            var lab3 = true;
            lab3: while (lab3 == true)
            {
                lab3 = false;
                v_4 = this.limit - this.cursor;
                var lab4 = true;
                lab4: while (lab4 == true)
                {
                    lab4 = false;
                    // (, line 206
                    // and, line 207
                    v_5 = this.limit - this.cursor;
                    // (, line 206
                    // or, line 206
                    var lab5 = true;
                    lab5: while (lab5 == true)
                    {
                        lab5 = false;
                        v_6 = this.limit - this.cursor;
                        var lab6 = true;
                        lab6: while (lab6 == true)
                        {
                            lab6 = false;
                            // call standard_suffix, line 206
                            if (!this.r_standard_suffix())
                            {
                                break lab6;
                            }
                            break lab5;
                        }
                        this.cursor = this.limit - v_6;
                        // call verb_suffix, line 206
                        if (!this.r_verb_suffix())
                        {
                            break lab4;
                        }
                    }
                    this.cursor = this.limit - v_5;
                    // do, line 207
                    v_7 = this.limit - this.cursor;
                    var lab7 = true;
                    lab7: while (lab7 == true)
                    {
                        lab7 = false;
                        // (, line 207
                        // [, line 207
                        this.ket = this.cursor;
                        // literal, line 207
                        if (!(this.eq_s_b(1, "i")))
                        {
                            break lab7;
                        }
                        // ], line 207
                        this.bra = this.cursor;
                        // test, line 207
                        v_8 = this.limit - this.cursor;
                        // literal, line 207
                        if (!(this.eq_s_b(1, "c")))
                        {
                            break lab7;
                        }
                        this.cursor = this.limit - v_8;
                        // call RV, line 207
                        if (!this.r_RV())
                        {
                            break lab7;
                        }
                        // delete, line 207
                        if (!this.slice_del())
                        {
                            return false;
                        }
                    }
                    this.cursor = this.limit - v_7;
                    break lab3;
                }
                this.cursor = this.limit - v_4;
                // call residual_suffix, line 209
                if (!this.r_residual_suffix())
                {
                    break lab2;
                }
            }
        }
        this.cursor = this.limit - v_3;
        // do, line 211
        v_9 = this.limit - this.cursor;
        var lab8 = true;
        lab8: while (lab8 == true)
        {
            lab8 = false;
            // call residual_form, line 211
            if (!this.r_residual_form())
            {
                break lab8;
            }
        }
        this.cursor = this.limit - v_9;
        this.cursor = this.limit_backward;        // do, line 213
        v_10 = this.cursor;
        var lab9 = true;
        lab9: while (lab9 == true)
        {
            lab9 = false;
            // call postlude, line 213
            if (!this.r_postlude())
            {
                break lab9;
            }
        }
        this.cursor = v_10;
        return true;
    }

    function equals (o : variant) : boolean {
        return o instanceof PortugueseStemmer;
    }

    function hashCode() : int
    {
        //http://stackoverflow.com/questions/194846/is-there-any-kind-of-hashcode-function-in-javascript
        var classname = "PortugueseStemmer";
        var hash = 0;
        if (classname.length == 0) return hash;
        for (var i = 0; i < classname.length; i++) {
            var char = classname.charCodeAt(i);
            hash = ((hash << 5) - hash) + char;
            hash = hash & hash; // Convert to 32bit integer
        }
        return hash;
    }

}

