Package net.sf.jcontracts.antlr

Examples of net.sf.jcontracts.antlr.Token


        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 12: // '\f'
                match('\f');
                break;

            case 10: // '\n'
            case 13: // '\r'
                if (la_1 == '\r' && la_2 == '\n')
                {
                    match("\r\n");
                }
                else if (la_1 == '\r')
                {
                    match('\r');
                }
                else if (la_1 == '\n')
                {
                    match('\n');
                }
                else
                {
                    throw new ScannerException("no viable alt for char: " + LA(1), getLine());
                }
                newline();
                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


        }
    }

    public final void classBlock(TypeMetaclass tmc) throws ParserException
    {
        Token l = null;
        Token r = null;
        try
        {
            l = LT(1);
            match(JavaTokenTypes.LCURLY);
            label0: do
View Full Code Here

        }
    }

    public final Class classDefinition(String supertypename) throws ParserException
    {
        Token id = null;
        Class cl = null;
        String extCl = null;
        Vector implCls = null;
        try
        {
            match(JavaTokenTypes.LITERAL_class);
            id = LT(1);
            match(JavaTokenTypes.IDENT);
            extCl = extendsClause();
            implCls = implementsClause();
            if (guessing == 0)
            {
                boolean prepend_packagename = supertypename.length() == 0;
                cl = getMetaclassFactory().newClass(supertypename + id.getText(), id.getLine(), prepend_packagename);
                cl.setImportList(getImportList());
                cl.setExtendedClass(extCl);
                cl.setImplementedInterfaces(implCls);
                addAnnotation(cl);
                pushOuterScope(cl);
View Full Code Here

        }
    }

    public final ExtendedToken[] compoundStatement() throws ParserException
    {
        Token s = null;
        Token e = null;
        ExtendedToken t2[] = null;
        ExtendedToken f = null;
        ExtendedToken g = null;
        boolean isFirstSuperOrThis = false;
        ExtendedToken statementAfterSuperOrThis = null;
View Full Code Here

        return extendedClass;
    }

    public final void field(TypeMetaclass tmc) throws ParserException
    {
        Token cc = null;
        Method m = null;
        Variable v = null;
        String ts = null;
        ExtendedToken pos[] = null;
        Vector mods = null;
View Full Code Here

        return !outerScope_.isEmpty();
    }

    public final String identifier() throws ParserException
    {
        Token id = null;
        Token id2 = null;
        String i = null;
        try
        {
            id = LT(1);
            match(JavaTokenTypes.IDENT);
            if (guessing == 0)
            {
                i = id.getText();
            }
            do
            {
                if (la_1 != JavaTokenTypes.DOT || la_2 != JavaTokenTypes.IDENT)
                {
                    break;
                }
                match(JavaTokenTypes.DOT);
                id2 = LT(1);
                match(JavaTokenTypes.IDENT);
                if (guessing == 0)
                {
                    i += "." + id2.getText();
                }
            }
            while (true);
        }
        catch (ParserException ex)
View Full Code Here

        return i;
    }

    public final String identifierStar() throws ParserException
    {
        Token i = null;
        Token j = null;
        String s = null;
        try
        {
            i = LT(1);
            match(JavaTokenTypes.IDENT);
            if (guessing == 0)
            {
                s = i.getText();
            }
            do
            {
                if (la_1 != JavaTokenTypes.DOT || la_2 != JavaTokenTypes.IDENT)
                {
                    break;
                }
                match(JavaTokenTypes.DOT);
                j = LT(1);
                match(JavaTokenTypes.IDENT);
                if (guessing == 0)
                {
                    s += "." + j.getText();
                }
            }
            while (true);
            if (la_1 == JavaTokenTypes.DOT)
            {
View Full Code Here

        }
    }

    public final Interface interfaceDefinition(String supertypename) throws ParserException
    {
        Token id = null;
        Interface ifa = null;
        Vector extIfs = null;
        try
        {
            match(JavaTokenTypes.LITERAL_interface);
            id = LT(1);
            match(JavaTokenTypes.IDENT);
            extIfs = interfaceExtends();
            if (guessing == 0)
            {
                boolean prepend_packagename = supertypename.length() == 0;
                ifa = getMetaclassFactory().newInterface(supertypename + id.getText(), id.getLine(),
                        prepend_packagename);
                ifa.setImportList(getImportList());
                ifa.setExtendedInterfaces(extIfs);
                addAnnotation(ifa);
                pushOuterScope(ifa);
View Full Code Here

        }
    }

    public final Method methodHead() throws ParserException
    {
        Token id = null;
        Vector pl = null;
        Method m = null;
        try
        {
            id = LT(1);
            match(JavaTokenTypes.IDENT);
            match(JavaTokenTypes.LPAREN);
            if (TOKEN_SET_24.member(la_1))
            {
                pl = parameterDeclarationList();
            }
            match(JavaTokenTypes.RPAREN);
            while (la_1 == JavaTokenTypes.LBRACK)
            {
                match(JavaTokenTypes.LBRACK);
                match(JavaTokenTypes.RBRACK);
            }
            throwsClause();
            if (guessing == 0)
            {
                m = getMetaclassFactory().newMethod(id.getText(), pl, id.getLine());
            }
        }
        catch (ParserException ex)
        {
            if (guessing == 0)
View Full Code Here

        }
    }

    public final void newExpression() throws ParserException
    {
        Token t = null;
        Token t2 = null;
        Class cl = null;
        TypeMetaclass outer_scope = getOuterScope();
        String typename = null;
        try
        {
            match(JavaTokenTypes.LITERAL_new);
            switch (la_1)
            {
                case JavaTokenTypes.IDENT:
                    t = LT(1);
                    match(JavaTokenTypes.IDENT);
                    if (guessing == 0)
                    {
                        typename = t.getText();
                    }
                    do
                    {
                        if (la_1 != JavaTokenTypes.DOT)
                        {
                            break;
                        }
                        match(JavaTokenTypes.DOT);
                        t2 = LT(1);
                        match(JavaTokenTypes.IDENT);
                        if (guessing == 0)
                        {
                            typename += "." + t2.getText();
                        }
                    }
                    while (true);
                    break;
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.