Package net.sf.jcontracts.antlr

Examples of net.sf.jcontracts.antlr.Token


        returnToken_ = token;
    }

    protected final void mDIGIT(boolean mustCreateToken) throws ScannerException
    {
        Token token = null;
        int begin = text.length();
        matchRange('0', '9');
        if (mustCreateToken)
        {
            token = makeToken(ArgTokenTypes.DIGIT);
            token.setText(new String(text.getBuffer(), begin, text.length() - begin));
        }
        returnToken_ = token;
    }
View Full Code Here


        returnToken_ = token;
    }

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

        returnToken_ = token;
    }

    protected final void mESC(boolean mustCreateToken) throws ScannerException
    {
        Token token = null;
        int begin = text.length();
        match('\\');
        switch (la_1)
        {
            case 110: // 'n'
                match('n');
                break;

            case 114: // 'r'
                match('r');
                break;

            case 116: // 't'
                match('t');
                break;

            case 98: // 'b'
                match('b');
                break;

            case 102: // 'f'
                match('f');
                break;

            case 34: // '"'
                match('"');
                break;

            case 39: // '\''
                match('\'');
                break;

            case 92: // '\\'
                match('\\');
                break;

            case 48: // '0'
            case 49: // '1'
            case 50: // '2'
            case 51: // '3'
                matchRange('0', '3');
                if (la_1 >= '0' && la_1 <= '9')
                {
                    mDIGIT(false);
                    if (la_1 >= '0' && la_1 <= '9')
                    {
                        mDIGIT(false);
                    }
                }
                break;

            case 52: // '4'
            case 53: // '5'
            case 54: // '6'
            case 55: // '7'
                matchRange('4', '7');
                if (la_1 >= '0' && la_1 <= '9')
                {
                    mDIGIT(false);
                }
                break;

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

        returnToken_ = token;
    }

    public final void mIDENT(boolean mustCreateToken) throws ScannerException
    {
        Token token = null;
        int begin = text.length();
        int tokenTypeId = ArgTokenTypes.IDENT;
        int count = 0;
        label0: do
        {
            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;

                case 95: // '_'
                    match('_');
                    break;

                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 36: // '$'
                    match('$');
                    break;

                case 46: // '.'
                    match('.');
                    break;

                case 45: // '-'
                    match('-');
                    break;

                case 92: // '\\'
                    match('\\');
                    break;

                case 47: // '/'
                    match('/');
                    break;

                case 58: // ':'
                    match(':');
                    break;

                case 64: // '@'
                    match('@');
                    break;

                case 42: // '*'
                    match('*');
                    break;

                default:
                    if (count < 1)
                    {
                        throw new ScannerException("no viable alt for char: " + LA(1), getLine());
                    }
                    break label0;
            }
            count++;
        }
        while (true);
        tokenTypeId = testLiteralsTable(tokenTypeId);
        if (mustCreateToken)
        {
            token = makeToken(tokenTypeId);
            token.setText(new String(text.getBuffer(), begin, text.length() - begin));
        }
        returnToken_ = token;
    }
View Full Code Here

        returnToken_ = token;
    }

    public final void mOPTION_WITH_ARG(boolean mustCreateToken) throws ScannerException
    {
        Token token = null;
        int begin = text.length();
        StringBuffer optionCharacterBuffer = new StringBuffer(1);
        StringBuffer argumentBuffer = new StringBuffer();
        String compound[] = null;
        mDASH(false);
        char optionCharacter = mCHAR(false);
        optionCharacterBuffer.append(optionCharacter);
        if (la_1 == '\'' && la_2 >= '\003' && la_2 <= '\377')
        {
            match('\'');
            while (TOKEN_SET_2.member(la_1))
            {
                char argumentCharacter = la_1;
                matchNot('\'');
                argumentBuffer.append(argumentCharacter);
            }

            match('\'');
        }
        else if (la_1 == '"' && la_2 >= '\003' && la_2 <= '\377')
        {
            match('"');
            while (TOKEN_SET_3.member(la_1))
            {
                char argumentCharacter = la_1;
                matchNot('"');
                argumentBuffer.append(argumentCharacter);
            }

            match('"');
        }
        else if (la_1 == ' ')
        {
            match(' ');
        }
        else
        {
            while (TOKEN_SET_4.member(la_1))
            {
                char argumentCharacter = la_1;
                match(TOKEN_SET_4);
                argumentBuffer.append(argumentCharacter);
            }

        }
        compound = new String[2];
        compound[0] = optionCharacterBuffer.toString();
        if (argumentBuffer.length() > 0)
        {
            compound[1] = argumentBuffer.toString();
        }
        setData(compound);
        if (mustCreateToken)
        {
            token = makeToken(ArgTokenTypes.OPTION_WITH_ARG);
            token.setText(new String(text.getBuffer(), begin, text.length() - begin));
        }
        returnToken_ = token;
    }
View Full Code Here

        returnToken_ = token;
    }

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

        returnToken_ = token;
    }

    public final void mSL_COMMENT(boolean mustCreateToken) throws ScannerException
    {
        Token token = null;
        int begin = text.length();
        match("//");
        while (TOKEN_SET_5.member(la_1))
        {
            matchNot('\n');
        }
        match('\n');
        newline();
        if (mustCreateToken)
        {
            token = makeToken(-1);
            token.setText(new String(text.getBuffer(), begin, text.length() - begin));
        }
        returnToken_ = token;
    }
View Full Code Here

        returnToken_ = token;
    }

    protected final void mVOCAB(boolean mustCreateToken) throws ScannerException
    {
        Token token = null;
        int begin = text.length();
        matchRange('\003', '\377');
        if (mustCreateToken)
        {
            token = makeToken(ArgTokenTypes.VOCAB);
            token.setText(new String(text.getBuffer(), begin, text.length() - begin));
        }
        returnToken_ = token;
    }
View Full Code Here

        returnToken_ = token;
    }

    public final void mWS(boolean mustCreateToken) throws ScannerException
    {
        Token token = null;
        int begin = text.length();
        switch (la_1)
        {
            case 32: // ' '
                match(' ');
                break;

            case 9: // '\t'
                match('\t');
                break;

            case 10: // '\n'
                match('\n');
                newline();
                break;

            case 13: // '\r'
                match('\r');
                break;

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

        returnToken_ = token;
    }

    public final void mMOD_ASSIGN(boolean mustCreateToken) throws ScannerException
    {
        Token token = null;
        int begin = text.length();
        match("%=");
        if (mustCreateToken)
        {
            token = makeToken(JavaTokenTypes.MOD_ASSIGN);
            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.