Examples of PathAST


Examples of mireka.address.parser.ast.PathAST

    public PathParser(CharScanner charScanner) {
        super(charScanner);
    }

    public PathAST parse() throws ParseException {
        PathAST pathAST = parsePath();
        if (currentToken.ch != -1)
            throw currentToken.otherSyntaxException("Superfluous characters "
                    + "after path: {0}.");
        return pathAST;
    }
View Full Code Here

Examples of mireka.address.parser.ast.PathAST

                    + "after path: {0}.");
        return pathAST;
    }

    public PathAST parseLeft() throws ParseException {
        PathAST pathAST = parsePath();
        scanner.pushBack(currentToken);
        return pathAST;
    }
View Full Code Here

Examples of mireka.address.parser.ast.PathAST

            sourceRouteAST = parseSourceRoute();
            accept(':');
        }
        MailboxAST mailboxAST = parseMailbox();
        accept('>');
        return new PathAST(popPosition(), sourceRouteAST, mailboxAST);
    }
View Full Code Here

Examples of mireka.address.parser.ast.PathAST

import org.junit.Test;

public class PathParserTest {
    @Test
    public void testSimplePath() throws Exception {
        PathAST pathAST = new PathParser("<john@example.com>").parse();
        assertNull(pathAST.sourceRouteAST);
        assertEquals("john", pathAST.mailboxAST.localPartAST.spelling);
        assertEquals("example.com", pathAST.mailboxAST.remotePartAST.spelling);
    }
View Full Code Here

Examples of mireka.address.parser.ast.PathAST

        assertEquals("example.com", pathAST.mailboxAST.remotePartAST.spelling);
    }

    @Test
    public void testSourceRoute1() throws Exception {
        PathAST pathAST = new PathParser("<@example.org:john@example.com>").parse();
        assertEquals(1, pathAST.sourceRouteAST.domainASTs.size());
        assertEquals("example.org", pathAST.sourceRouteAST.domainASTs.get(0).spelling);
        assertEquals("john", pathAST.mailboxAST.localPartAST.spelling);
    }
View Full Code Here

Examples of mireka.address.parser.ast.PathAST

        assertEquals("john", pathAST.mailboxAST.localPartAST.spelling);
    }

    @Test
    public void testSourceRoute2() throws Exception {
        PathAST pathAST =
                new PathParser("<@example.org@example.net:john@example.com>")
                        .parse();
        assertEquals(2, pathAST.sourceRouteAST.domainASTs.size());
        assertEquals("example.org", pathAST.sourceRouteAST.domainASTs.get(0).spelling);
        assertEquals("john", pathAST.mailboxAST.localPartAST.spelling);
View Full Code Here

Examples of mireka.address.parser.ast.PathAST

        if (inputEquals("<>")) {
            accept('<');
            accept('>');
            return new NullReversePathAST(popPosition());
        } else {
            PathAST pathAST = parsePath();
            return new RealReversePathAST(popPosition(), pathAST);
        }
    }
View Full Code Here

Examples of mireka.address.parser.ast.PathAST

        return peekString(s.length()).equals(s);
    }

    private PathAST parsePath() throws ParseException {
        scanner.pushBack(currentToken);
        PathAST pathAST = new PathParser(scanner).parseLeft();
        currentToken = scanner.scan();
        return pathAST;
    }
View Full Code Here

Examples of mireka.address.parser.ast.PathAST

    private RecipientAST parseRecipient() throws ParseException {
        String DOMAIN_POSTMASTER_PREFIX = "<Postmaster@";
        String SYSTEM_POSTMASTER_PREFIX = "<Postmaster>";
        pushPosition();
        if (inputEqualsIgnoreCase(DOMAIN_POSTMASTER_PREFIX)) {
            PathAST pathAST = parsePath();
            if (pathAST.mailboxAST.remotePartAST instanceof DomainRemotePartAST)
                return new DomainPostmasterRecipientAST(popPosition(),
                        pathAST.mailboxAST);
            else
                return new MailboxRecipientAST(popPosition(), pathAST);
        } else if (inputEqualsIgnoreCase(SYSTEM_POSTMASTER_PREFIX)) {
            accept('<');
            pushSpelling();
            acceptThem(SYSTEM_POSTMASTER_PREFIX.length() - 2);
            String postmasterSpelling = popSpelling();
            accept('>');
            return new SystemPostmasterRecipientAST(popPosition(), postmasterSpelling);
        } else {
            PathAST pathAST = parsePath();
            return new MailboxRecipientAST(popPosition(), pathAST);
        }
    }
View Full Code Here

Examples of mireka.address.parser.ast.PathAST

                sLowerCase);
    }

    private PathAST parsePath() throws ParseException {
        scanner.pushBack(currentToken);
        PathAST pathAST = new PathParser(scanner).parseLeft();
        currentToken = scanner.scan();
        return pathAST;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.