Package seph.lang.ast

Examples of seph.lang.ast.Message.literal()


    @Test
    public void parses_a_string_using_alternative_syntax_correctly() {
        Message result = parse(" %[blargus hello \"something else\" - he]");

        assertTrue("Result should be a literal message", result.isLiteral());
        SephObject literal = result.literal();
        assertEquals(Text.class, literal.getClass());
        assertEquals("blargus hello \"something else\" - he", ((Text)literal).text());
        assertNull(result.next());
    }
View Full Code Here


    }

    @Test
    public void handles_e_escape_in_text() {
        Message result = parse("\"foo \\e\"");
        assertEquals("foo " + (char)27, ((Text)result.literal()).text());
    }

    @Test
    public void handles_e_escape_in_text_with_alt_syntax() {
        Message result = parse("%[foo \\e]");
View Full Code Here

    }

    @Test
    public void handles_e_escape_in_text_with_alt_syntax() {
        Message result = parse("%[foo \\e]");
        assertEquals("foo " + (char)27, ((Text)result.literal()).text());
    }

    @Test
    public void handles_cr_escape_in_text() {
        Message result = parse("\"foo \\\r\"");
View Full Code Here

    }

    @Test
    public void handles_cr_escape_in_text() {
        Message result = parse("\"foo \\\r\"");
        assertEquals("foo ", ((Text)result.literal()).text());
    }

    @Test
    public void handles_cr_escape_in_text_with_alt_syntax() {
        Message result = parse("%[foo \\\r]");
View Full Code Here

    }

    @Test
    public void handles_cr_escape_in_text_with_alt_syntax() {
        Message result = parse("%[foo \\\r]");
        assertEquals("foo ", ((Text)result.literal()).text());
    }

    @Test
    public void handles_cr_lf_escape_in_text() {
        Message result = parse("\"foo \\\r\n\"");
View Full Code Here

    }

    @Test
    public void handles_cr_lf_escape_in_text() {
        Message result = parse("\"foo \\\r\n\"");
        assertEquals("foo ", ((Text)result.literal()).text());
    }

    @Test
    public void handles_cr_lf_escape_in_text_with_alt_syntax() {
        Message result = parse("%[foo \\\r\n]");
View Full Code Here

    }

    @Test
    public void handles_cr_lf_escape_in_text_with_alt_syntax() {
        Message result = parse("%[foo \\\r\n]");
        assertEquals("foo ", ((Text)result.literal()).text());
    }

    @Test
    public void generates_an_error_when_mismatched_curly_brackets() {
        parse("foo({1, 2)}", "blargus.sp");
View Full Code Here

    @Test
    public void parses_a_regular_expression() {
        Message result = parse(" %/foo/");
        assertTrue("Result should be a literal message", result.isLiteral());
        SephObject literal = result.literal();
        assertEquals(Regexp.class, literal.getClass());
        assertEquals("foo", ((Regexp)literal).pattern());
        assertNull(result.next());
    }
View Full Code Here

    }

    @Test
    public void parses_a_regular_expression_with_flags() {
        Message result = parse(" %/bar/ix");
        SephObject literal = result.literal();
        assertEquals("bar", ((Regexp)literal).pattern());
        assertEquals("ix", ((Regexp)literal).flags());
        assertNull(result.next());
    }
View Full Code Here

    @Test
    public void parses_a_regular_expression_with_alternative_syntax() {
        Message result = parse(" %r[foo]");
        assertTrue("Result should be a literal message", result.isLiteral());
        SephObject literal = result.literal();
        assertEquals(Regexp.class, literal.getClass());
        assertEquals("foo", ((Regexp)literal).pattern());
        assertNull(result.next());
    }
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.