Package net.sf.jcontracts.antlr

Examples of net.sf.jcontracts.antlr.Token


        returnToken_ = _token;
    }

    protected final void mSL_COMMENT(boolean _createToken) throws ScannerException
    {
        Token _token = null;
        int _begin = text.length();
        int _ttype = 34;
        match("//");
        while (_tokenSet_7.member(la_1))
        {
            matchNot('\n');
        }
        match('\n');
        newline();
        if (_createToken)
        {
            _token = makeToken(_ttype);
            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
        }
        returnToken_ = _token;
    }
View Full Code Here


        returnToken_ = _token;
    }

    public final void mSTRING_LITERAL(boolean _createToken) throws ScannerException
    {
        Token _token = null;
        int _begin = text.length();
        int _ttype = 13;
        match('"');
        label0: do
        {
            switch (la_1)
            {
                case 92: // '\\'
                    mESC(false);
                    break;

                case 3: // '\003'
                case 4: // '\004'
                case 5: // '\005'
                case 6: // '\006'
                case 7: // '\007'
                case 8: // '\b'
                case 9: // '\t'
                case 10: // '\n'
                case 11: // '\013'
                case 12: // '\f'
                case 13: // '\r'
                case 14: // '\016'
                case 15: // '\017'
                case 16: // '\020'
                case 17: // '\021'
                case 18: // '\022'
                case 19: // '\023'
                case 20: // '\024'
                case 21: // '\025'
                case 22: // '\026'
                case 23: // '\027'
                case 24: // '\030'
                case 25: // '\031'
                case 26: // '\032'
                case 27: // '\033'
                case 28: // '\034'
                case 29: // '\035'
                case 30: // '\036'
                case 31: // '\037'
                case 32: // ' '
                case 33: // '!'
                case 35: // '#'
                case 36: // '$'
                case 37: // '%'
                case 38: // '&'
                case 39: // '\''
                case 40: // '('
                case 41: // ')'
                case 42: // '*'
                case 43: // '+'
                case 44: // ','
                case 45: // '-'
                case 46: // '.'
                case 47: // '/'
                case 48: // '0'
                case 49: // '1'
                case 50: // '2'
                case 51: // '3'
                case 52: // '4'
                case 53: // '5'
                case 54: // '6'
                case 55: // '7'
                case 56: // '8'
                case 57: // '9'
                case 58: // ':'
                case 59: // ';'
                case 60: // '<'
                case 61: // '='
                case 62: // '>'
                case 63: // '?'
                case 64: // '@'
                case 65: // 'A'
                case 66: // 'B'
                case 67: // 'C'
                case 68: // 'D'
                case 69: // 'E'
                case 70: // 'F'
                case 71: // 'G'
                case 72: // 'H'
                case 73: // 'I'
                case 74: // 'J'
                case 75: // 'K'
                case 76: // 'L'
                case 77: // 'M'
                case 78: // 'N'
                case 79: // 'O'
                case 80: // 'P'
                case 81: // 'Q'
                case 82: // 'R'
                case 83: // 'S'
                case 84: // 'T'
                case 85: // 'U'
                case 86: // 'V'
                case 87: // 'W'
                case 88: // 'X'
                case 89: // 'Y'
                case 90: // 'Z'
                case 91: // '['
                case 93: // ']'
                case 94: // '^'
                case 95: // '_'
                case 96: // '`'
                case 97: // 'a'
                case 98: // 'b'
                case 99: // 'c'
                case 100: // 'd'
                case 101: // 'e'
                case 102: // 'f'
                case 103: // 'g'
                case 104: // 'h'
                case 105: // 'i'
                case 106: // 'j'
                case 107: // 'k'
                case 108: // 'l'
                case 109: // 'm'
                case 110: // 'n'
                case 111: // 'o'
                case 112: // 'p'
                case 113: // 'q'
                case 114: // 'r'
                case 115: // 's'
                case 116: // 't'
                case 117: // 'u'
                case 118: // 'v'
                case 119: // 'w'
                case 120: // 'x'
                case 121: // 'y'
                case 122: // 'z'
                case 123: // '{'
                case 124: // '|'
                case 125: // '}'
                case 126: // '~'
                    matchNot('"');
                    break;

                default:
                    match('"');
                    break label0;
            }
        }
        while (true);
        if (_createToken)
        {
            _token = makeToken(_ttype);
            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
        }
        returnToken_ = _token;
    }
View Full Code Here

        returnToken_ = _token;
    }

    public final void mSUBRULE_BLOCK(boolean _createToken) throws ScannerException
    {
        Token _token = null;
        int _begin = text.length();
        int _ttype = 28;
        match('(');
        if (_tokenSet_0.member(la_1) && _tokenSet_2.member(la_2))
        {
            int _saveIndex = text.length();
            mWS(false);
            text.setLength(_saveIndex);
        }
        mALT(false);
        if (_tokenSet_0.member(la_1))
        {
            int _saveIndex = text.length();
            mWS(false);
            text.setLength(_saveIndex);
        }
        do
        {
            if (la_1 != '|')
            {
                break;
            }
            match('|');
            if (_tokenSet_0.member(la_1) && _tokenSet_2.member(la_2))
            {
                int _saveIndex = text.length();
                mWS(false);
                text.setLength(_saveIndex);
            }
            mALT(false);
            if (_tokenSet_0.member(la_1))
            {
                int _saveIndex = text.length();
                mWS(false);
                text.setLength(_saveIndex);
            }
        }
        while (true);
        match(')');
        if (_tokenSet_0.member(la_1))
        {
            int _saveIndex = text.length();
            mWS(false);
            text.setLength(_saveIndex);
        }
        if (la_1 == '=' && la_2 == '>')
        {
            match("=>");
            if (_tokenSet_0.member(la_1))
            {
                int _saveIndex = text.length();
                mWS(false);
                text.setLength(_saveIndex);
            }
        }
        else if (la_1 == '*')
        {
            match('*');
            if (_tokenSet_0.member(la_1))
            {
                int _saveIndex = text.length();
                mWS(false);
                text.setLength(_saveIndex);
            }
        }
        else if (la_1 == '+')
        {
            match('+');
            if (_tokenSet_0.member(la_1))
            {
                int _saveIndex = text.length();
                mWS(false);
                text.setLength(_saveIndex);
            }
        }
        else if (la_1 == '?')
        {
            match('?');
            if (_tokenSet_0.member(la_1))
            {
                int _saveIndex = text.length();
                mWS(false);
                text.setLength(_saveIndex);
            }
        }
        if (_createToken)
        {
            _token = makeToken(_ttype);
            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
        }
        returnToken_ = _token;
    }
View Full Code Here

        returnToken_ = _token;
    }

    public final void mWS(boolean _createToken) throws ScannerException
    {
        Token _token = null;
        int _begin = text.length();
        int _ttype = 32;
        int _cnt = 0;
        do
        {
            if (la_1 == ' ')
            {
                match(' ');
            }
            else if (la_1 == '\t')
            {
                match('\t');
            }
            else if (la_1 == '\n')
            {
                match('\n');
                newline();
            }
            else if (la_1 == '\r')
            {
                match('\r');
            }
            else
            {
                if (_cnt < 1)
                {
                    throw new ScannerException("no viable alt for char: " + LA(1), getLine());
                }
                break;
            }
            _cnt++;
        }
        while (true);
        _ttype = -1;
        if (_createToken)
        {
            _token = makeToken(_ttype);
            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
        }
        returnToken_ = _token;
    }
View Full Code Here

        returnToken_ = _token;
    }

    protected final void mXDIGIT(boolean _createToken) throws ScannerException
    {
        Token _token = null;
        int _begin = text.length();
        int _ttype = 39;
        switch (la_1)
        {
            case 48: // '0'
            case 49: // '1'
            case 50: // '2'
            case 51: // '3'
            case 52: // '4'
            case 53: // '5'
            case 54: // '6'
            case 55: // '7'
            case 56: // '8'
            case 57: // '9'
                matchRange('0', '9');
                break;

            case 97: // 'a'
            case 98: // 'b'
            case 99: // 'c'
            case 100: // 'd'
            case 101: // 'e'
            case 102: // 'f'
                matchRange('a', 'f');
                break;

            case 65: // 'A'
            case 66: // 'B'
            case 67: // 'C'
            case 68: // 'D'
            case 69: // 'E'
            case 70: // 'F'
                matchRange('A', 'F');
                break;

            default:
                throw new ScannerException("no viable alt for char: " + LA(1), getLine());
        }
        if (_createToken)
        {
            _token = makeToken(_ttype);
            _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
        }
        returnToken_ = _token;
    }
View Full Code Here

    public final OptionMetaclass option() throws ParserException
    {
        Vector arguments = new Vector();
        String compound[] = null;
        Token o2 = LT(1);
        match(ArgTokenTypes.OPTION_WITH_ARG);
        compound = (String[]) ((ExtendedToken) o2).getData();
        if (compound[1] != null)
        {
            arguments.addElement(compound[1]);
        }
        while (la_1 == ArgTokenTypes.COMMA)
        {
            match(ArgTokenTypes.COMMA);
            Token j = LT(1);
            match(ArgTokenTypes.IDENT);
            arguments.addElement(j.getText());
        }
        return getMetaclassFactory().newOption(compound[0], arguments);
    }
View Full Code Here

        metaclassFactory_ = metaclassFactory;
    }

    public final TargetMetaclass target() throws ParserException
    {
        Token j = LT(1);
        match(ArgTokenTypes.IDENT);
        String tokenText = j.getText();
        return getMetaclassFactory().newTarget(tokenText);
    }
View Full Code Here

        return result;
    }

    private final char mCHAR(boolean mustCreateToken) throws ScannerException
    {
        Token token = null;
        int begin = text.length();
        switch (la_1)
        {
            case 97: // 'a'
            case 98: // 'b'
            case 99: // 'c'
            case 100: // 'd'
            case 101: // 'e'
            case 102: // 'f'
            case 103: // 'g'
            case 104: // 'h'
            case 105: // 'i'
            case 106: // 'j'
            case 107: // 'k'
            case 108: // 'l'
            case 109: // 'm'
            case 110: // 'n'
            case 111: // 'o'
            case 112: // 'p'
            case 113: // 'q'
            case 114: // 'r'
            case 115: // 's'
            case 116: // 't'
            case 117: // 'u'
            case 118: // 'v'
            case 119: // 'w'
            case 120: // 'x'
            case 121: // 'y'
            case 122: // 'z'
                matchRange('a', 'z');
                break;

            case 65: // 'A'
            case 66: // 'B'
            case 67: // 'C'
            case 68: // 'D'
            case 69: // 'E'
            case 70: // 'F'
            case 71: // 'G'
            case 72: // 'H'
            case 73: // 'I'
            case 74: // 'J'
            case 75: // 'K'
            case 76: // 'L'
            case 77: // 'M'
            case 78: // 'N'
            case 79: // 'O'
            case 80: // 'P'
            case 81: // 'Q'
            case 82: // 'R'
            case 83: // 'S'
            case 84: // 'T'
            case 85: // 'U'
            case 86: // 'V'
            case 87: // 'W'
            case 88: // 'X'
            case 89: // 'Y'
            case 90: // 'Z'
                matchRange('A', 'Z');
                break;

            default:
                throw new ScannerException("no viable alt for char: " + LA(1), getLine());
        }
        char character = LA(0);
        if (mustCreateToken)
        {
            token = makeToken(ArgTokenTypes.CHAR);
            token.setText(new String(text.getBuffer(), begin, text.length() - begin));
        }
        returnToken_ = token;
        return character;
    }
View Full Code Here

        return character;
    }

    private final void mCOMMA(boolean mustCreateToken) throws ScannerException
    {
        Token token = null;
        int begin = text.length();
        match(',');
        if (mustCreateToken)
        {
            token = makeToken(ArgTokenTypes.COMMA);
            token.setText(new String(text.getBuffer(), begin, text.length() - begin));
        }
        returnToken_ = token;
    }
View Full Code Here

        returnToken_ = token;
    }

    private final void mDASH(boolean mustCreateToken) throws ScannerException
    {
        Token token = null;
        int begin = text.length();
        match("-");
        if (mustCreateToken)
        {
            token = makeToken(ArgTokenTypes.DASH);
            token.setText(new String(text.getBuffer(), begin, text.length() - begin));
        }
        returnToken_ = token;
    }
View Full Code Here

TOP

Related Classes of net.sf.jcontracts.antlr.Token

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.