Package seph.lang.persistent

Examples of seph.lang.persistent.IPersistentList


        assertNull(result.next());
    }

    @Test
    public void parses_the_toplevel_with_commas() {
        IPersistentList result = parseAll("foo,\nbar: method");
        assertEquals("foo", ((Message)result.seq().first()).name());
        assertNull(((Message)result.seq().first()).next());
        assertEquals("bar:", ((Message)result.seq().more().first()).name());
        assertEquals("method", ((Message)result.seq().more().first()).next().name());
    }
View Full Code Here


        this.unaryOperators = unaryOperators;
        this.scope = new StaticScope(null);
    }

    public IPersistentList parseFully() throws IOException, ControlFlow {
        IPersistentList all = parseCommaSeparatedMessageChains();

        if(all.count() == 0) {
            all = (IPersistentList)all.cons(NamedMessage.create(".", null, null, sourcename, 0, 0, scope));
        }

        return all;
    }
View Full Code Here

        while(isLetter(rr = peek()) || isIDDigit(rr) || rr == ':' || rr == '!' || rr == '?' || rr == '$') {
            read();
            sb.append((char)rr);
        }

        IPersistentList args = null;
        if(rr == '(') {
            read();
            args = parseCommaSeparatedMessageChains();
            parseCharacter(')');
            top.currentMessageChain.add(NamedMessage.create(sb.toString(), args, null, sourcename, l, cc, scope));
View Full Code Here

            result = sb.toString();
        }

        if(rr == '(') {
            read();
            IPersistentList args = parseCommaSeparatedMessageChains();
            parseCharacter(')');
            top.currentMessageChain.add(NamedMessage.create(result, args, null, sourcename,  l, cc, scope));
            top.added();
            return;
        } else {
View Full Code Here

                // FALL THROUGH
            default:
                if(rr == '(') {
                    boolean abstraction = sb.toString().equals("#");
                    read();
                    IPersistentList args = null;
                    if(abstraction) {
                        scope = new StaticScope(scope);
                        args = parseCommaSeparatedMessageChainsAddingArgumentNames();
                    } else {
                        args = parseCommaSeparatedMessageChains();
View Full Code Here

    }

    private void parseEmptyMessageSend() throws IOException, ControlFlow {
        int l = lineNumber; int cc = currentCharacter-1;

        IPersistentList args = parseCommaSeparatedMessageChains();
        parseCharacter(')');

        top.currentMessageChain.add(NamedMessage.create("", args, null, sourcename,  l, cc, scope));
        top.added();
    }
View Full Code Here

        int rr = peek();
        int r2 = peek2();


        IPersistentList args = null;
        if(rr == end && r2 == '(') {
            read();
            read();
            args = parseCommaSeparatedMessageChains();
            parseCharacter(')');
View Full Code Here

    private void parseSimpleOpenCloseMessageSend(char end, String name) throws IOException, ControlFlow {
        int l = lineNumber; int cc = currentCharacter-1;

        read();
        IPersistentList args = parseCommaSeparatedMessageChains();
        parseCharacter(end);

        top.currentMessageChain.add(NamedMessage.create(name, args, null, sourcename,  l, cc, scope));
        top.added();
    }
View Full Code Here

    public Message next() {
        throw new RuntimeException("ESCAPED MUTABLE MESSAGE");
    }

    public Message withNext(Message newNext) {
        IPersistentList args = realArguments == null ? null :
            (firstArgument == null ? new PersistentList(realArguments) : PersistentList.create(Arrays.asList(firstArgument, realArguments)));

        return NamedMessage.create(name, args, newNext, filename, line, position, scope);
    }
View Full Code Here

        assertEquals("foo", msg.name());
    }

    @Test
    public void has_a_list_of_arguments() {
        IPersistentList args = PersistentList.create(Arrays.<Message>asList(NamedMessage.create(null, null, null, null, 0, 0, null), NamedMessage.create(null, null, null, null, 0, 0, null)));
        NamedMessage msg = NamedMessage.create(null, args, null, null, 0, 0, null);
        assertSame(args, msg.arguments());
    }
View Full Code Here

TOP

Related Classes of seph.lang.persistent.IPersistentList

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.